OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_EXTENSIONS_SUSPICIOUS_EXTENSION_BUBBLE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SUSPICIOUS_EXTENSION_BUBBLE_CONTROLLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_SUSPICIOUS_EXTENSION_BUBBLE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SUSPICIOUS_EXTENSION_BUBBLE_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
9 | 9 |
10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" | |
11 #include "extensions/common/extension.h" | |
12 | |
13 class Browser; | |
14 class ExtensionService; | |
15 class Profile; | 10 class Profile; |
16 | 11 |
17 using extensions::ExtensionMessageBubbleController; | |
18 | |
19 namespace { | |
20 | |
21 class SuspiciousExtensionBubbleDelegate | |
22 : public ExtensionMessageBubbleController::Delegate { | |
23 public: | |
24 explicit SuspiciousExtensionBubbleDelegate(Profile* profile); | |
25 virtual ~SuspiciousExtensionBubbleDelegate(); | |
26 | |
27 // ExtensionMessageBubbleController::Delegate methods. | |
28 virtual bool ShouldIncludeExtension(const std::string& extension_id) OVERRIDE; | |
29 virtual void AcknowledgeExtension( | |
30 const std::string& extension_id, | |
31 ExtensionMessageBubbleController::BubbleAction user_action) OVERRIDE; | |
32 virtual void PerformAction(const extensions::ExtensionIdList& list) OVERRIDE; | |
33 virtual base::string16 GetTitle() const OVERRIDE; | |
34 virtual base::string16 GetMessageBody() const OVERRIDE; | |
35 virtual base::string16 GetOverflowText( | |
36 const base::string16& overflow_count) const OVERRIDE; | |
37 virtual base::string16 GetLearnMoreLabel() const OVERRIDE; | |
38 virtual GURL GetLearnMoreUrl() const OVERRIDE; | |
39 virtual base::string16 GetActionButtonLabel() const OVERRIDE; | |
40 virtual base::string16 GetDismissButtonLabel() const OVERRIDE; | |
41 virtual bool ShouldShowExtensionList() const OVERRIDE; | |
42 virtual void LogExtensionCount(size_t count) OVERRIDE; | |
43 virtual void LogAction( | |
44 ExtensionMessageBubbleController::BubbleAction action) OVERRIDE; | |
45 | |
46 private: | |
47 // Our profile. Weak, not owned by us. | |
48 Profile* profile_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(SuspiciousExtensionBubbleDelegate); | |
51 }; | |
52 | |
53 } // namespace | |
54 | |
55 namespace extensions { | 12 namespace extensions { |
56 | 13 |
57 class SuspiciousExtensionBubble; | 14 class SuspiciousExtensionBubble; |
58 | 15 |
59 class SuspiciousExtensionBubbleController | 16 class SuspiciousExtensionBubbleController |
60 : public ExtensionMessageBubbleController { | 17 : public extensions::ExtensionMessageBubbleController { |
61 public: | 18 public: |
62 // Clears the list of profiles the bubble has been shown for. Should only be | 19 // Clears the list of profiles the bubble has been shown for. Should only be |
63 // used during testing. | 20 // used during testing. |
64 static void ClearProfileListForTesting(); | 21 static void ClearProfileListForTesting(); |
65 | 22 |
66 explicit SuspiciousExtensionBubbleController(Profile* profile); | 23 explicit SuspiciousExtensionBubbleController(Profile* profile); |
67 virtual ~SuspiciousExtensionBubbleController(); | 24 virtual ~SuspiciousExtensionBubbleController(); |
68 | 25 |
69 // Whether the controller knows of extensions to list in the bubble. Returns | 26 // Whether the controller knows of extensions to list in the bubble. Returns |
70 // true if so. | 27 // true if so. |
71 bool ShouldShow(); | 28 bool ShouldShow(); |
72 | 29 |
73 // ExtensionMessageBubbleController methods. | 30 // ExtensionMessageBubbleController methods. |
74 virtual void Show(ExtensionMessageBubble* bubble) OVERRIDE; | 31 virtual void Show(ExtensionMessageBubble* bubble) OVERRIDE; |
75 | 32 |
76 private: | 33 private: |
77 // A weak pointer to the profile we are associated with. Not owned by us. | 34 // A weak pointer to the profile we are associated with. Not owned by us. |
78 Profile* profile_; | 35 Profile* profile_; |
79 | 36 |
80 DISALLOW_COPY_AND_ASSIGN(SuspiciousExtensionBubbleController); | 37 DISALLOW_COPY_AND_ASSIGN(SuspiciousExtensionBubbleController); |
81 }; | 38 }; |
82 | 39 |
83 } // namespace extensions | 40 } // namespace extensions |
84 | 41 |
85 #endif // CHROME_BROWSER_EXTENSIONS_SUSPICIOUS_EXTENSION_BUBBLE_CONTROLLER_H_ | 42 #endif // CHROME_BROWSER_EXTENSIONS_SUSPICIOUS_EXTENSION_BUBBLE_CONTROLLER_H_ |
OLD | NEW |