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(TabContents* contents, | 96 virtual void TabInsertedAt(TabContents* contents, |
91 int index, | 97 int index, |
92 bool foreground) OVERRIDE; | 98 bool foreground) OVERRIDE; |
93 virtual void TabDetachedAt(TabContents* contents, int index) OVERRIDE; | 99 virtual void TabDetachedAt(TabContents* contents, int index) OVERRIDE; |
94 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 100 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
95 TabContents* old_contents, | 101 TabContents* old_contents, |
96 TabContents* new_contents, | 102 TabContents* new_contents, |
97 int index) OVERRIDE; | 103 int index) OVERRIDE; |
98 | 104 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 content::NotificationRegistrar registrar_; | 183 content::NotificationRegistrar registrar_; |
178 PrefChangeRegistrar profile_pref_registrar_; | 184 PrefChangeRegistrar profile_pref_registrar_; |
179 PrefChangeRegistrar local_pref_registrar_; | 185 PrefChangeRegistrar local_pref_registrar_; |
180 | 186 |
181 DISALLOW_COPY_AND_ASSIGN(BrowserCommandController); | 187 DISALLOW_COPY_AND_ASSIGN(BrowserCommandController); |
182 }; | 188 }; |
183 | 189 |
184 } // namespace chrome | 190 } // namespace chrome |
185 | 191 |
186 #endif // CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ | 192 #endif // CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ |
OLD | NEW |