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