| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/prefs/public/pref_change_registrar.h" | 8 #include "base/prefs/public/pref_change_registrar.h" |
| 9 #include "base/prefs/public/pref_observer.h" |
| 9 #include "chrome/browser/api/sync/profile_sync_service_observer.h" | 10 #include "chrome/browser/api/sync/profile_sync_service_observer.h" |
| 10 #include "chrome/browser/command_updater.h" | 11 #include "chrome/browser/command_updater.h" |
| 11 #include "chrome/browser/sessions/tab_restore_service_observer.h" | 12 #include "chrome/browser/sessions/tab_restore_service_observer.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 15 #include "webkit/glue/window_open_disposition.h" | 16 #include "webkit/glue/window_open_disposition.h" |
| 16 | 17 |
| 17 class Browser; | 18 class Browser; |
| 18 class BrowserWindow; | 19 class BrowserWindow; |
| 19 class Profile; | 20 class Profile; |
| 20 class TabContents; | 21 class TabContents; |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 struct NativeWebKeyboardEvent; | 24 struct NativeWebKeyboardEvent; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace chrome { | 27 namespace chrome { |
| 27 | 28 |
| 28 class BrowserCommandController : public CommandUpdater::CommandUpdaterDelegate, | 29 class BrowserCommandController : public CommandUpdater::CommandUpdaterDelegate, |
| 29 public content::NotificationObserver, | 30 public content::NotificationObserver, |
| 31 public PrefObserver, |
| 30 public TabStripModelObserver, | 32 public TabStripModelObserver, |
| 31 public TabRestoreServiceObserver, | 33 public TabRestoreServiceObserver, |
| 32 public ProfileSyncServiceObserver { | 34 public ProfileSyncServiceObserver { |
| 33 public: | 35 public: |
| 34 explicit BrowserCommandController(Browser* browser); | 36 explicit BrowserCommandController(Browser* browser); |
| 35 virtual ~BrowserCommandController(); | 37 virtual ~BrowserCommandController(); |
| 36 | 38 |
| 37 CommandUpdater* command_updater() { return &command_updater_; } | 39 CommandUpdater* command_updater() { return &command_updater_; } |
| 38 bool block_command_execution() const { return block_command_execution_; } | 40 bool block_command_execution() const { return block_command_execution_; } |
| 39 | 41 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Overridden from CommandUpdater::CommandUpdaterDelegate: | 81 // Overridden from CommandUpdater::CommandUpdaterDelegate: |
| 80 virtual void ExecuteCommandWithDisposition( | 82 virtual void ExecuteCommandWithDisposition( |
| 81 int id, | 83 int id, |
| 82 WindowOpenDisposition disposition) OVERRIDE; | 84 WindowOpenDisposition disposition) OVERRIDE; |
| 83 | 85 |
| 84 // Overridden from content::NotificationObserver: | 86 // Overridden from content::NotificationObserver: |
| 85 virtual void Observe(int type, | 87 virtual void Observe(int type, |
| 86 const content::NotificationSource& source, | 88 const content::NotificationSource& source, |
| 87 const content::NotificationDetails& details) OVERRIDE; | 89 const content::NotificationDetails& details) OVERRIDE; |
| 88 | 90 |
| 91 // Overridden from PrefObserver: |
| 92 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 93 const std::string& pref_name) OVERRIDE; |
| 94 |
| 89 // Overridden from TabStripModelObserver: | 95 // Overridden from TabStripModelObserver: |
| 90 virtual void TabInsertedAt(content::WebContents* contents, | 96 virtual void TabInsertedAt(content::WebContents* contents, |
| 91 int index, | 97 int index, |
| 92 bool foreground) OVERRIDE; | 98 bool foreground) OVERRIDE; |
| 93 virtual void TabDetachedAt(content::WebContents* contents, | 99 virtual void TabDetachedAt(content::WebContents* contents, |
| 94 int index) OVERRIDE; | 100 int index) OVERRIDE; |
| 95 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 101 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
| 96 content::WebContents* old_contents, | 102 content::WebContents* old_contents, |
| 97 content::WebContents* new_contents, | 103 content::WebContents* new_contents, |
| 98 int index) OVERRIDE; | 104 int index) OVERRIDE; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 126 | 132 |
| 127 // Updates commands for enabling developer tools. | 133 // Updates commands for enabling developer tools. |
| 128 void UpdateCommandsForDevTools(); | 134 void UpdateCommandsForDevTools(); |
| 129 | 135 |
| 130 // Updates commands for bookmark editing. | 136 // Updates commands for bookmark editing. |
| 131 void UpdateCommandsForBookmarkEditing(); | 137 void UpdateCommandsForBookmarkEditing(); |
| 132 | 138 |
| 133 // Updates commands that affect the bookmark bar. | 139 // Updates commands that affect the bookmark bar. |
| 134 void UpdateCommandsForBookmarkBar(); | 140 void UpdateCommandsForBookmarkBar(); |
| 135 | 141 |
| 136 // Updates commands that affect file selection dialogs in aggregate, | |
| 137 // namely the save-page-as state and the open-file state. | |
| 138 void UpdateCommandsForFileSelectionDialogs(); | |
| 139 | |
| 140 // Update commands whose state depends on the type of fullscreen mode the | 142 // Update commands whose state depends on the type of fullscreen mode the |
| 141 // window is in. | 143 // window is in. |
| 142 void UpdateCommandsForFullscreenMode(FullScreenMode fullscreen_mode); | 144 void UpdateCommandsForFullscreenMode(FullScreenMode fullscreen_mode); |
| 143 | 145 |
| 144 // Update commands whose state depends on whether multiple profiles are | 146 // Update commands whose state depends on whether multiple profiles are |
| 145 // allowed. | 147 // allowed. |
| 146 void UpdateCommandsForMultipleProfiles(); | 148 void UpdateCommandsForMultipleProfiles(); |
| 147 | 149 |
| 148 // Updates the printing command state. | 150 // Updates the printing command state. |
| 149 void UpdatePrintingState(); | 151 void UpdatePrintingState(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 content::NotificationRegistrar registrar_; | 189 content::NotificationRegistrar registrar_; |
| 188 PrefChangeRegistrar profile_pref_registrar_; | 190 PrefChangeRegistrar profile_pref_registrar_; |
| 189 PrefChangeRegistrar local_pref_registrar_; | 191 PrefChangeRegistrar local_pref_registrar_; |
| 190 | 192 |
| 191 DISALLOW_COPY_AND_ASSIGN(BrowserCommandController); | 193 DISALLOW_COPY_AND_ASSIGN(BrowserCommandController); |
| 192 }; | 194 }; |
| 193 | 195 |
| 194 } // namespace chrome | 196 } // namespace chrome |
| 195 | 197 |
| 196 #endif // CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ | 198 #endif // CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ |
| OLD | NEW |