| 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 #include "chrome/browser/extensions/dev_mode_bubble_controller.h" | 5 #include "chrome/browser/extensions/dev_mode_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/extensions/extension_action_manager.h" | 9 #include "chrome/browser/extensions/extension_action_manager.h" |
| 10 #include "chrome/browser/extensions/extension_message_bubble.h" | 10 #include "chrome/browser/extensions/extension_message_bubble.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 base::LazyInstance<std::set<Profile*> > g_shown_for_profiles = | 28 base::LazyInstance<std::set<Profile*> > g_shown_for_profiles = |
| 29 LAZY_INSTANCE_INITIALIZER; | 29 LAZY_INSTANCE_INITIALIZER; |
| 30 | 30 |
| 31 //////////////////////////////////////////////////////////////////////////////// | 31 //////////////////////////////////////////////////////////////////////////////// |
| 32 // DevModeBubbleDelegate | 32 // DevModeBubbleDelegate |
| 33 | 33 |
| 34 class DevModeBubbleDelegate | 34 class DevModeBubbleDelegate |
| 35 : public ExtensionMessageBubbleController::Delegate { | 35 : public ExtensionMessageBubbleController::Delegate { |
| 36 public: | 36 public: |
| 37 explicit DevModeBubbleDelegate(Profile* profile); | 37 explicit DevModeBubbleDelegate(Profile* profile); |
| 38 virtual ~DevModeBubbleDelegate(); | 38 ~DevModeBubbleDelegate() override; |
| 39 | 39 |
| 40 // ExtensionMessageBubbleController::Delegate methods. | 40 // ExtensionMessageBubbleController::Delegate methods. |
| 41 virtual bool ShouldIncludeExtension(const std::string& extension_id) override; | 41 bool ShouldIncludeExtension(const std::string& extension_id) override; |
| 42 virtual void AcknowledgeExtension( | 42 void AcknowledgeExtension( |
| 43 const std::string& extension_id, | 43 const std::string& extension_id, |
| 44 ExtensionMessageBubbleController::BubbleAction user_action) override; | 44 ExtensionMessageBubbleController::BubbleAction user_action) override; |
| 45 virtual void PerformAction(const ExtensionIdList& list) override; | 45 void PerformAction(const ExtensionIdList& list) override; |
| 46 virtual void OnClose() override; | 46 void OnClose() override; |
| 47 virtual base::string16 GetTitle() const override; | 47 base::string16 GetTitle() const override; |
| 48 virtual base::string16 GetMessageBody( | 48 base::string16 GetMessageBody(bool anchored_to_browser_action) const override; |
| 49 bool anchored_to_browser_action) const override; | 49 base::string16 GetOverflowText( |
| 50 virtual base::string16 GetOverflowText( | |
| 51 const base::string16& overflow_count) const override; | 50 const base::string16& overflow_count) const override; |
| 52 virtual GURL GetLearnMoreUrl() const override; | 51 GURL GetLearnMoreUrl() const override; |
| 53 virtual base::string16 GetActionButtonLabel() const override; | 52 base::string16 GetActionButtonLabel() const override; |
| 54 virtual base::string16 GetDismissButtonLabel() const override; | 53 base::string16 GetDismissButtonLabel() const override; |
| 55 virtual bool ShouldShowExtensionList() const override; | 54 bool ShouldShowExtensionList() const override; |
| 56 virtual void LogExtensionCount(size_t count) override; | 55 void LogExtensionCount(size_t count) override; |
| 57 virtual void LogAction( | 56 void LogAction( |
| 58 ExtensionMessageBubbleController::BubbleAction action) override; | 57 ExtensionMessageBubbleController::BubbleAction action) override; |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 // Our extension service. Weak, not owned by us. | 60 // Our extension service. Weak, not owned by us. |
| 62 ExtensionService* service_; | 61 ExtensionService* service_; |
| 63 | 62 |
| 64 DISALLOW_COPY_AND_ASSIGN(DevModeBubbleDelegate); | 63 DISALLOW_COPY_AND_ASSIGN(DevModeBubbleDelegate); |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 DevModeBubbleDelegate::DevModeBubbleDelegate(Profile* profile) | 66 DevModeBubbleDelegate::DevModeBubbleDelegate(Profile* profile) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 return !g_shown_for_profiles.Get().count(profile_->GetOriginalProfile()) && | 172 return !g_shown_for_profiles.Get().count(profile_->GetOriginalProfile()) && |
| 174 !GetExtensionList().empty(); | 173 !GetExtensionList().empty(); |
| 175 } | 174 } |
| 176 | 175 |
| 177 void DevModeBubbleController::Show(ExtensionMessageBubble* bubble) { | 176 void DevModeBubbleController::Show(ExtensionMessageBubble* bubble) { |
| 178 g_shown_for_profiles.Get().insert(profile_->GetOriginalProfile()); | 177 g_shown_for_profiles.Get().insert(profile_->GetOriginalProfile()); |
| 179 ExtensionMessageBubbleController::Show(bubble); | 178 ExtensionMessageBubbleController::Show(bubble); |
| 180 } | 179 } |
| 181 | 180 |
| 182 } // namespace extensions | 181 } // namespace extensions |
| OLD | NEW |