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_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ | 5 #ifndef CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ |
6 #define CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ | 6 #define CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <bitset> | |
10 | |
9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "chrome/app/chrome_command_ids.h" | |
13 #include "chrome/browser/protector/base_setting_change.h" | 16 #include "chrome/browser/protector/base_setting_change.h" |
14 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
15 #include "chrome/browser/ui/global_error.h" | 18 #include "chrome/browser/ui/global_error.h" |
16 | 19 |
17 class Browser; | 20 class Browser; |
18 class Profile; | 21 class Profile; |
19 | 22 |
20 namespace protector { | 23 namespace protector { |
21 | 24 |
22 class BaseSettingChange; | 25 class BaseSettingChange; |
(...skipping 10 matching lines...) Expand all Loading... | |
33 SettingsChangeGlobalErrorDelegate* delegate); | 36 SettingsChangeGlobalErrorDelegate* delegate); |
34 virtual ~SettingsChangeGlobalError(); | 37 virtual ~SettingsChangeGlobalError(); |
35 | 38 |
36 // Displays a global error bubble for the given browser profile. | 39 // Displays a global error bubble for the given browser profile. |
37 // Can be called from any thread. | 40 // Can be called from any thread. |
38 void ShowForProfile(Profile* profile); | 41 void ShowForProfile(Profile* profile); |
39 | 42 |
40 // Removes global error from its profile. | 43 // Removes global error from its profile. |
41 void RemoveFromProfile(); | 44 void RemoveFromProfile(); |
42 | 45 |
46 // Returns the change instance to which this error refers. | |
47 BaseSettingChange* change() { return change_; } | |
48 | |
43 private: | 49 private: |
44 // GlobalError implementation. | 50 // GlobalError implementation. |
45 virtual bool HasBadge() OVERRIDE; | 51 virtual bool HasBadge() OVERRIDE; |
46 virtual int GetBadgeResourceID() OVERRIDE; | 52 virtual int GetBadgeResourceID() OVERRIDE; |
47 virtual bool HasMenuItem() OVERRIDE; | 53 virtual bool HasMenuItem() OVERRIDE; |
48 virtual int MenuItemCommandID() OVERRIDE; | 54 virtual int MenuItemCommandID() OVERRIDE; |
49 virtual string16 MenuItemLabel() OVERRIDE; | 55 virtual string16 MenuItemLabel() OVERRIDE; |
50 virtual int MenuItemIconResourceID() OVERRIDE; | 56 virtual int MenuItemIconResourceID() OVERRIDE; |
51 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; | 57 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; |
52 virtual bool HasBubbleView() OVERRIDE; | 58 virtual bool HasBubbleView() OVERRIDE; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 Profile* profile_; | 96 Profile* profile_; |
91 | 97 |
92 // True if user has dismissed the bubble by clicking on one of the buttons. | 98 // True if user has dismissed the bubble by clicking on one of the buttons. |
93 bool closed_by_button_; | 99 bool closed_by_button_; |
94 | 100 |
95 // True if the bubble has to be shown on the next browser window activation. | 101 // True if the bubble has to be shown on the next browser window activation. |
96 bool show_on_browser_activation_; | 102 bool show_on_browser_activation_; |
97 | 103 |
98 base::WeakPtrFactory<SettingsChangeGlobalError> weak_factory_; | 104 base::WeakPtrFactory<SettingsChangeGlobalError> weak_factory_; |
99 | 105 |
106 // Menu command ID assigned to |this| from the pool of available IDs. | |
107 int menu_id_; | |
108 | |
109 // Unset bits indicate available command IDs. | |
110 static std::bitset<IDC_SHOW_SETTINGS_CHANGE_LAST - | |
whywhat
2012/02/29 18:55:14
Using statis non-elementary types members is also
Ivan Korotkov
2012/02/29 19:23:44
As discussed, it's used application-wide for vecto
| |
111 IDC_SHOW_SETTINGS_CHANGE_FIRST + 1> menu_ids_; | |
112 | |
100 DISALLOW_COPY_AND_ASSIGN(SettingsChangeGlobalError); | 113 DISALLOW_COPY_AND_ASSIGN(SettingsChangeGlobalError); |
101 }; | 114 }; |
102 | 115 |
103 } // namespace protector | 116 } // namespace protector |
104 | 117 |
105 #endif // CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ | 118 #endif // CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ |
OLD | NEW |