Skip to content

Commit

Permalink
Standardize usage of virtual/override/final in apps/
Browse files Browse the repository at this point in the history
The Google C++ style guide states:

  Explicitly annotate overrides of virtual functions or virtual
  destructors with an override or (less frequently) final specifier.
  Older (pre-C++11) code will use the virtual keyword as an inferior
  alternative annotation. For clarity, use exactly one of override,
  final, or virtual when declaring an override.

To better conform to these guidelines, the following constructs have
been rewritten:

- if a base class has a virtual destructor, then:
    virtual ~Foo();                   ->  ~Foo() override;
- virtual void Foo() override;        ->  void Foo() override;
- virtual void Foo() override final;  ->  void Foo() final;

This patch was automatically generated. The clang plugin can generate
fixit hints, which are suggested edits when it is 100% sure it knows how
to fix a problem. The hints from the clang plugin were applied to the
source tree using the tool in https://codereview.chromium.org/598073004.

BUG=417463
R=scheib@chromium.org

Review URL: https://codereview.chromium.org/666213002

Cr-Commit-Position: refs/heads/master@{#300609}
  • Loading branch information
zetafunction authored and Commit bot committed Oct 22, 2014
1 parent 60f67cb commit 2f5be41
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 71 deletions.
16 changes: 8 additions & 8 deletions apps/app_lifetime_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,24 @@ class AppLifetimeMonitor : public KeyedService,
};

explicit AppLifetimeMonitor(Profile* profile);
virtual ~AppLifetimeMonitor();
~AppLifetimeMonitor() override;

void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);

private:
// content::NotificationObserver overrides:
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;

// extensions::AppWindowRegistry::Observer overrides:
virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) override;
virtual void OnAppWindowHidden(extensions::AppWindow* app_window) override;
virtual void OnAppWindowShown(extensions::AppWindow* app_window) override;
void OnAppWindowRemoved(extensions::AppWindow* app_window) override;
void OnAppWindowHidden(extensions::AppWindow* app_window) override;
void OnAppWindowShown(extensions::AppWindow* app_window) override;

// KeyedService overrides:
virtual void Shutdown() override;
void Shutdown() override;

bool HasVisibleAppWindows(extensions::AppWindow* app_window) const;

Expand Down
10 changes: 5 additions & 5 deletions apps/app_lifetime_monitor_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ class AppLifetimeMonitorFactory : public BrowserContextKeyedServiceFactory {
friend struct DefaultSingletonTraits<AppLifetimeMonitorFactory>;

AppLifetimeMonitorFactory();
virtual ~AppLifetimeMonitorFactory();
~AppLifetimeMonitorFactory() override;

// BrowserContextKeyedServiceFactory:
virtual KeyedService* BuildServiceInstanceFor(
KeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const override;
virtual bool ServiceIsCreatedWithBrowserContext() const override;
virtual content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;
bool ServiceIsCreatedWithBrowserContext() const override;
content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;
};

} // namespace apps
Expand Down
10 changes: 5 additions & 5 deletions apps/app_load_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AppLoadService : public KeyedService,
};

explicit AppLoadService(Profile* profile);
virtual ~AppLoadService();
~AppLoadService() override;

// Reload the application with the given id and then send it the OnRestarted
// event.
Expand All @@ -65,12 +65,12 @@ class AppLoadService : public KeyedService,

private:
// content::NotificationObserver.
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;

// extensions::ExtensionRegistryObserver.
virtual void OnExtensionUnloaded(
void OnExtensionUnloaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension,
extensions::UnloadedExtensionInfo::Reason reason) override;
Expand Down
10 changes: 5 additions & 5 deletions apps/app_load_service_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class AppLoadServiceFactory : public BrowserContextKeyedServiceFactory {
friend struct DefaultSingletonTraits<AppLoadServiceFactory>;

AppLoadServiceFactory();
virtual ~AppLoadServiceFactory();
~AppLoadServiceFactory() override;

// BrowserContextKeyedServiceFactory:
virtual KeyedService* BuildServiceInstanceFor(
KeyedService* BuildServiceInstanceFor(
content::BrowserContext* context) const override;
virtual bool ServiceIsCreatedWithBrowserContext() const override;
virtual bool ServiceIsNULLWhileTesting() const override;
virtual content::BrowserContext* GetBrowserContextToUse(
bool ServiceIsCreatedWithBrowserContext() const override;
bool ServiceIsNULLWhileTesting() const override;
content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;
};

Expand Down
14 changes: 6 additions & 8 deletions apps/app_restore_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ class AppRestoreService : public KeyedService,

private:
// AppLifetimeMonitor::Observer.
virtual void OnAppStart(Profile* profile, const std::string& app_id) override;
virtual void OnAppActivated(Profile* profile,
const std::string& app_id) override;
virtual void OnAppDeactivated(Profile* profile,
const std::string& app_id) override;
virtual void OnAppStop(Profile* profile, const std::string& app_id) override;
virtual void OnChromeTerminating() override;
void OnAppStart(Profile* profile, const std::string& app_id) override;
void OnAppActivated(Profile* profile, const std::string& app_id) override;
void OnAppDeactivated(Profile* profile, const std::string& app_id) override;
void OnAppStop(Profile* profile, const std::string& app_id) override;
void OnChromeTerminating() override;

// KeyedService.
virtual void Shutdown() override;
void Shutdown() override;

void RecordAppStart(const std::string& extension_id);
void RecordAppStop(const std::string& extension_id);
Expand Down
6 changes: 3 additions & 3 deletions apps/app_restore_service_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class AppRestoreServiceFactory : public BrowserContextKeyedServiceFactory {
friend struct DefaultSingletonTraits<AppRestoreServiceFactory>;

AppRestoreServiceFactory();
virtual ~AppRestoreServiceFactory();
~AppRestoreServiceFactory() override;

// BrowserContextKeyedServiceFactory:
virtual KeyedService* BuildServiceInstanceFor(
KeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const override;
virtual bool ServiceIsCreatedWithBrowserContext() const override;
bool ServiceIsCreatedWithBrowserContext() const override;
};

} // namespace apps
Expand Down
55 changes: 25 additions & 30 deletions apps/custom_launcher_page_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,56 +34,51 @@ class CustomLauncherPageContents
public:
CustomLauncherPageContents(scoped_ptr<extensions::AppDelegate> app_delegate,
const std::string& extension_id);
virtual ~CustomLauncherPageContents();
~CustomLauncherPageContents() override;

// Called to initialize and load the WebContents.
void Initialize(content::BrowserContext* context, const GURL& url);

content::WebContents* web_contents() const { return web_contents_.get(); }

// content::WebContentsDelegate overrides:
virtual content::WebContents* OpenURLFromTab(
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;
virtual void AddNewContents(content::WebContents* source,
content::WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture,
bool* was_blocked) override;
virtual bool IsPopupOrPanel(
const content::WebContents* source) const override;
virtual bool ShouldSuppressDialogs() override;
virtual bool PreHandleGestureEvent(
content::WebContents* source,
const blink::WebGestureEvent& event) override;
virtual content::ColorChooser* OpenColorChooser(
void AddNewContents(content::WebContents* source,
content::WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture,
bool* was_blocked) override;
bool IsPopupOrPanel(const content::WebContents* source) const override;
bool ShouldSuppressDialogs() override;
bool PreHandleGestureEvent(content::WebContents* source,
const blink::WebGestureEvent& event) override;
content::ColorChooser* OpenColorChooser(
content::WebContents* web_contents,
SkColor color,
const std::vector<content::ColorSuggestion>& suggestions) override;
virtual void RunFileChooser(
content::WebContents* tab,
const content::FileChooserParams& params) override;
virtual void RequestToLockMouse(content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) override;
virtual void RequestMediaAccessPermission(
void RunFileChooser(content::WebContents* tab,
const content::FileChooserParams& params) override;
void RequestToLockMouse(content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) override;
void RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) override;
virtual bool CheckMediaAccessPermission(
content::WebContents* web_contents,
const GURL& security_origin,
content::MediaStreamType type) override;
bool CheckMediaAccessPermission(content::WebContents* web_contents,
const GURL& security_origin,
content::MediaStreamType type) override;

private:
// content::WebContentsObserver overrides:
virtual bool OnMessageReceived(const IPC::Message& message) override;
bool OnMessageReceived(const IPC::Message& message) override;

// extensions::ExtensionFunctionDispatcher::Delegate overrides:
virtual extensions::WindowController* GetExtensionWindowController()
const override;
virtual content::WebContents* GetAssociatedWebContents() const override;
extensions::WindowController* GetExtensionWindowController() const override;
content::WebContents* GetAssociatedWebContents() const override;

void OnRequest(const ExtensionHostMsg_Request_Params& params);

Expand Down
2 changes: 1 addition & 1 deletion apps/load_and_launch_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class PlatformAppLoadAndLaunchBrowserTest : public PlatformAppBrowserTest {
protected:
PlatformAppLoadAndLaunchBrowserTest() {}

virtual void SetUpCommandLine(CommandLine* command_line) override {
void SetUpCommandLine(CommandLine* command_line) override {
PlatformAppBrowserTest::SetUpCommandLine(command_line);
app_path_ = test_data_dir_
.AppendASCII("platform_apps")
Expand Down
8 changes: 4 additions & 4 deletions apps/saved_files_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SavedFilesService : public KeyedService,
public content::NotificationObserver {
public:
explicit SavedFilesService(Profile* profile);
virtual ~SavedFilesService();
~SavedFilesService() override;

static SavedFilesService* Get(Profile* profile);

Expand Down Expand Up @@ -109,9 +109,9 @@ class SavedFilesService : public KeyedService,
class SavedFiles;

// content::NotificationObserver.
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;

// Returns the SavedFiles for |extension_id| or NULL if one does not exist.
SavedFiles* Get(const std::string& extension_id) const;
Expand Down
4 changes: 2 additions & 2 deletions apps/saved_files_service_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ class SavedFilesServiceFactory : public BrowserContextKeyedServiceFactory {

private:
SavedFilesServiceFactory();
virtual ~SavedFilesServiceFactory();
~SavedFilesServiceFactory() override;
friend struct DefaultSingletonTraits<SavedFilesServiceFactory>;

virtual KeyedService* BuildServiceInstanceFor(
KeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const override;
};

Expand Down

0 comments on commit 2f5be41

Please sign in to comment.