OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 #include "chrome/browser/extensions/ntp_overridden_bubble_controller.h" | 5 #include "chrome/browser/extensions/ntp_overridden_bubble_controller.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // page. | 23 // page. |
24 const char kNtpBubbleAcknowledged[] = "ack_ntp_bubble"; | 24 const char kNtpBubbleAcknowledged[] = "ack_ntp_bubble"; |
25 | 25 |
26 //////////////////////////////////////////////////////////////////////////////// | 26 //////////////////////////////////////////////////////////////////////////////// |
27 // NtpOverriddenBubbleDelegate | 27 // NtpOverriddenBubbleDelegate |
28 | 28 |
29 class NtpOverriddenBubbleDelegate | 29 class NtpOverriddenBubbleDelegate |
30 : public extensions::ExtensionMessageBubbleController::Delegate { | 30 : public extensions::ExtensionMessageBubbleController::Delegate { |
31 public: | 31 public: |
32 NtpOverriddenBubbleDelegate(ExtensionService* service, Profile* profile); | 32 NtpOverriddenBubbleDelegate(ExtensionService* service, Profile* profile); |
33 virtual ~NtpOverriddenBubbleDelegate(); | 33 ~NtpOverriddenBubbleDelegate() override; |
34 | 34 |
35 // ExtensionMessageBubbleController::Delegate methods. | 35 // ExtensionMessageBubbleController::Delegate methods. |
36 virtual bool ShouldIncludeExtension(const std::string& extension_id) override; | 36 bool ShouldIncludeExtension(const std::string& extension_id) override; |
37 virtual void AcknowledgeExtension( | 37 void AcknowledgeExtension( |
38 const std::string& extension_id, | 38 const std::string& extension_id, |
39 extensions::ExtensionMessageBubbleController::BubbleAction | 39 extensions::ExtensionMessageBubbleController::BubbleAction user_action) |
40 user_action) override; | 40 override; |
41 virtual void PerformAction(const extensions::ExtensionIdList& list) override; | 41 void PerformAction(const extensions::ExtensionIdList& list) override; |
42 virtual base::string16 GetTitle() const override; | 42 base::string16 GetTitle() const override; |
43 virtual base::string16 GetMessageBody( | 43 base::string16 GetMessageBody(bool anchored_to_browser_action) const override; |
44 bool anchored_to_browser_action) const override; | 44 base::string16 GetOverflowText( |
45 virtual base::string16 GetOverflowText( | |
46 const base::string16& overflow_count) const override; | 45 const base::string16& overflow_count) const override; |
47 virtual GURL GetLearnMoreUrl() const override; | 46 GURL GetLearnMoreUrl() const override; |
48 virtual base::string16 GetActionButtonLabel() const override; | 47 base::string16 GetActionButtonLabel() const override; |
49 virtual base::string16 GetDismissButtonLabel() const override; | 48 base::string16 GetDismissButtonLabel() const override; |
50 virtual bool ShouldShowExtensionList() const override; | 49 bool ShouldShowExtensionList() const override; |
51 virtual void RestrictToSingleExtension( | 50 void RestrictToSingleExtension(const std::string& extension_id) override; |
52 const std::string& extension_id) override; | 51 void LogExtensionCount(size_t count) override; |
53 virtual void LogExtensionCount(size_t count) override; | 52 void LogAction(extensions::ExtensionMessageBubbleController::BubbleAction |
54 virtual void LogAction( | 53 action) override; |
55 extensions::ExtensionMessageBubbleController::BubbleAction | |
56 action) override; | |
57 | 54 |
58 private: | 55 private: |
59 // Our extension service. Weak, not owned by us. | 56 // Our extension service. Weak, not owned by us. |
60 ExtensionService* service_; | 57 ExtensionService* service_; |
61 | 58 |
62 // The ID of the extension we are showing the bubble for. | 59 // The ID of the extension we are showing the bubble for. |
63 std::string extension_id_; | 60 std::string extension_id_; |
64 | 61 |
65 DISALLOW_COPY_AND_ASSIGN(NtpOverriddenBubbleDelegate); | 62 DISALLOW_COPY_AND_ASSIGN(NtpOverriddenBubbleDelegate); |
66 }; | 63 }; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 182 |
186 delegate()->RestrictToSingleExtension(extension_id); | 183 delegate()->RestrictToSingleExtension(extension_id); |
187 return true; | 184 return true; |
188 } | 185 } |
189 | 186 |
190 bool NtpOverriddenBubbleController::CloseOnDeactivate() { | 187 bool NtpOverriddenBubbleController::CloseOnDeactivate() { |
191 return true; | 188 return true; |
192 } | 189 } |
193 | 190 |
194 } // namespace extensions | 191 } // namespace extensions |
OLD | NEW |