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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
11 #include "base/prefs/pref_member.h" | 11 #include "base/prefs/pref_member.h" |
12 #include "chrome/browser/command_updater.h" | 12 #include "chrome/browser/command_updater.h" |
13 #include "chrome/browser/command_updater_delegate.h" | 13 #include "chrome/browser/command_updater_delegate.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
15 #include "components/sessions/core/tab_restore_service_observer.h" | 15 #include "components/sessions/core/tab_restore_service_observer.h" |
16 #include "ui/base/window_open_disposition.h" | 16 #include "ui/base/window_open_disposition.h" |
17 | 17 |
18 class Browser; | 18 class Browser; |
19 class BrowserWindow; | 19 class BrowserWindow; |
20 class Profile; | 20 class Profile; |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 struct NativeWebKeyboardEvent; | 23 struct NativeWebKeyboardEvent; |
24 } | 24 } |
25 | 25 |
26 namespace chrome { | 26 namespace chrome { |
27 | 27 |
28 class BrowserCommandController : public CommandUpdaterDelegate, | 28 class BrowserCommandController : public CommandUpdaterDelegate, |
29 public TabStripModelObserver, | 29 public TabStripModelObserver, |
30 public TabRestoreServiceObserver { | 30 public sessions::TabRestoreServiceObserver { |
31 public: | 31 public: |
32 explicit BrowserCommandController(Browser* browser); | 32 explicit BrowserCommandController(Browser* browser); |
33 ~BrowserCommandController() override; | 33 ~BrowserCommandController() override; |
34 | 34 |
35 CommandUpdater* command_updater() { return &command_updater_; } | 35 CommandUpdater* command_updater() { return &command_updater_; } |
36 bool block_command_execution() const { return block_command_execution_; } | 36 bool block_command_execution() const { return block_command_execution_; } |
37 | 37 |
38 // Returns true if |command_id| is a reserved command whose keyboard shortcuts | 38 // Returns true if |command_id| is a reserved command whose keyboard shortcuts |
39 // should not be sent to the renderer or |event| was triggered by a key that | 39 // should not be sent to the renderer or |event| was triggered by a key that |
40 // we never want to send to the renderer. | 40 // we never want to send to the renderer. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 bool foreground) override; | 88 bool foreground) override; |
89 void TabDetachedAt(content::WebContents* contents, int index) override; | 89 void TabDetachedAt(content::WebContents* contents, int index) override; |
90 void TabReplacedAt(TabStripModel* tab_strip_model, | 90 void TabReplacedAt(TabStripModel* tab_strip_model, |
91 content::WebContents* old_contents, | 91 content::WebContents* old_contents, |
92 content::WebContents* new_contents, | 92 content::WebContents* new_contents, |
93 int index) override; | 93 int index) override; |
94 void TabBlockedStateChanged(content::WebContents* contents, | 94 void TabBlockedStateChanged(content::WebContents* contents, |
95 int index) override; | 95 int index) override; |
96 | 96 |
97 // Overridden from TabRestoreServiceObserver: | 97 // Overridden from TabRestoreServiceObserver: |
98 void TabRestoreServiceChanged(TabRestoreService* service) override; | 98 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override; |
99 void TabRestoreServiceDestroyed(TabRestoreService* service) override; | 99 void TabRestoreServiceDestroyed( |
100 void TabRestoreServiceLoaded(TabRestoreService* service) override; | 100 sessions::TabRestoreService* service) override; |
| 101 void TabRestoreServiceLoaded(sessions::TabRestoreService* service) override; |
101 | 102 |
102 // Returns true if the regular Chrome UI (not the fullscreen one and | 103 // Returns true if the regular Chrome UI (not the fullscreen one and |
103 // not the single-tab one) is shown. Used for updating window command states | 104 // not the single-tab one) is shown. Used for updating window command states |
104 // only. Consider using SupportsWindowFeature if you need the mentioned | 105 // only. Consider using SupportsWindowFeature if you need the mentioned |
105 // functionality anywhere else. | 106 // functionality anywhere else. |
106 bool IsShowingMainUI(); | 107 bool IsShowingMainUI(); |
107 | 108 |
108 // Initialize state for all browser commands. | 109 // Initialize state for all browser commands. |
109 void InitCommandState(); | 110 void InitCommandState(); |
110 | 111 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 PrefChangeRegistrar profile_pref_registrar_; | 187 PrefChangeRegistrar profile_pref_registrar_; |
187 PrefChangeRegistrar local_pref_registrar_; | 188 PrefChangeRegistrar local_pref_registrar_; |
188 BooleanPrefMember pref_signin_allowed_; | 189 BooleanPrefMember pref_signin_allowed_; |
189 | 190 |
190 DISALLOW_COPY_AND_ASSIGN(BrowserCommandController); | 191 DISALLOW_COPY_AND_ASSIGN(BrowserCommandController); |
191 }; | 192 }; |
192 | 193 |
193 } // namespace chrome | 194 } // namespace chrome |
194 | 195 |
195 #endif // CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ | 196 #endif // CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ |
OLD | NEW |