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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/protector/base_setting_change.h" | 14 #include "chrome/browser/protector/base_setting_change.h" |
14 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
15 #include "chrome/browser/ui/global_error.h" | 16 #include "chrome/browser/ui/global_error.h" |
16 | 17 |
17 class Browser; | 18 class Browser; |
18 class Profile; | 19 class Profile; |
19 | 20 |
20 namespace protector { | 21 namespace protector { |
21 | 22 |
22 class BaseSettingChange; | 23 class BaseSettingChange; |
(...skipping 10 matching lines...) Expand all Loading... |
33 SettingsChangeGlobalErrorDelegate* delegate); | 34 SettingsChangeGlobalErrorDelegate* delegate); |
34 virtual ~SettingsChangeGlobalError(); | 35 virtual ~SettingsChangeGlobalError(); |
35 | 36 |
36 // Displays a global error bubble for the given browser profile. | 37 // Displays a global error bubble for the given browser profile. |
37 // Can be called from any thread. | 38 // Can be called from any thread. |
38 void ShowForProfile(Profile* profile); | 39 void ShowForProfile(Profile* profile); |
39 | 40 |
40 // Removes global error from its profile. | 41 // Removes global error from its profile. |
41 void RemoveFromProfile(); | 42 void RemoveFromProfile(); |
42 | 43 |
| 44 // Returns the change instance to which this error refers. |
| 45 BaseSettingChange* change() { return change_; } |
| 46 |
43 private: | 47 private: |
44 // GlobalError implementation. | 48 // GlobalError implementation. |
45 virtual bool HasBadge() OVERRIDE; | 49 virtual bool HasBadge() OVERRIDE; |
46 virtual int GetBadgeResourceID() OVERRIDE; | 50 virtual int GetBadgeResourceID() OVERRIDE; |
47 virtual bool HasMenuItem() OVERRIDE; | 51 virtual bool HasMenuItem() OVERRIDE; |
48 virtual int MenuItemCommandID() OVERRIDE; | 52 virtual int MenuItemCommandID() OVERRIDE; |
49 virtual string16 MenuItemLabel() OVERRIDE; | 53 virtual string16 MenuItemLabel() OVERRIDE; |
50 virtual int MenuItemIconResourceID() OVERRIDE; | 54 virtual int MenuItemIconResourceID() OVERRIDE; |
51 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; | 55 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; |
52 virtual bool HasBubbleView() OVERRIDE; | 56 virtual bool HasBubbleView() OVERRIDE; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 Profile* profile_; | 94 Profile* profile_; |
91 | 95 |
92 // True if user has dismissed the bubble by clicking on one of the buttons. | 96 // True if user has dismissed the bubble by clicking on one of the buttons. |
93 bool closed_by_button_; | 97 bool closed_by_button_; |
94 | 98 |
95 // True if the bubble has to be shown on the next browser window activation. | 99 // True if the bubble has to be shown on the next browser window activation. |
96 bool show_on_browser_activation_; | 100 bool show_on_browser_activation_; |
97 | 101 |
98 base::WeakPtrFactory<SettingsChangeGlobalError> weak_factory_; | 102 base::WeakPtrFactory<SettingsChangeGlobalError> weak_factory_; |
99 | 103 |
| 104 // Menu command ID assigned to |this| from the pool of available IDs. |
| 105 int menu_id_; |
| 106 |
100 DISALLOW_COPY_AND_ASSIGN(SettingsChangeGlobalError); | 107 DISALLOW_COPY_AND_ASSIGN(SettingsChangeGlobalError); |
101 }; | 108 }; |
102 | 109 |
103 } // namespace protector | 110 } // namespace protector |
104 | 111 |
105 #endif // CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ | 112 #endif // CHROME_BROWSER_PROTECTOR_SETTINGS_CHANGE_GLOBAL_ERROR_H_ |
OLD | NEW |