OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_DEV_MODE_BUBBLE_CONTROLLER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_DEV_MODE_BUBBLE_CONTROLLER_DELEGATE_H_ |
| 7 |
| 8 #include <string> |
| 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
| 10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
| 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" |
| 13 #include "extensions/common/extension.h" |
| 14 |
| 15 class Browser; |
| 16 class ExtensionService; |
| 17 |
| 18 namespace extensions { |
| 19 |
| 20 class DevModeBubble; |
| 21 |
| 22 class DevModeBubbleControllerDelegate |
| 23 : public ProfileKeyedAPI, |
| 24 public ExtensionMessageBubbleController::Delegate { |
| 25 public: |
| 26 explicit DevModeBubbleControllerDelegate(Profile* profile); |
| 27 virtual ~DevModeBubbleControllerDelegate(); |
| 28 |
| 29 // ProfileKeyedAPI implementation. |
| 30 static ProfileKeyedAPIFactory< |
| 31 DevModeBubbleControllerDelegate>* GetFactoryInstance(); |
| 32 |
| 33 // Convenience method to get the DevModeBubbleControllerDelegate for a |
| 34 // profile. |
| 35 static DevModeBubbleControllerDelegate* Get(Profile* profile); |
| 36 |
| 37 // Returns true if the extension is considered a Developer Mode extension. |
| 38 bool IsDevModeExtension(const Extension* extension) const; |
| 39 |
| 40 // ExtensionMessageBubbleController::Delegate methods. |
| 41 virtual void Show(ExtensionMessageBubble* bubble) OVERRIDE; |
| 42 virtual bool ShowingBubble() const OVERRIDE; |
| 43 virtual bool HasExtensionList() const OVERRIDE; |
| 44 virtual std::vector<string16> GetExtensionList() const OVERRIDE; |
| 45 virtual const ExtensionIdList& GetExtensionIdList() const OVERRIDE; |
| 46 virtual bool ShouldIncludeExtension(const std::string& extension_id) OVERRIDE; |
| 47 virtual void AcknowledgeExtension( |
| 48 const std::string& extension_id, |
| 49 ExtensionMessageBubbleController::BubbleAction user_action) OVERRIDE; |
| 50 virtual void PerformAction(const ExtensionIdList& list) OVERRIDE; |
| 51 virtual string16 GetTitle() const OVERRIDE; |
| 52 virtual string16 GetMessageBody() const OVERRIDE; |
| 53 virtual string16 GetOverflowText( |
| 54 const string16& overflow_count) const OVERRIDE; |
| 55 virtual string16 GetLearnMoreLabel() const OVERRIDE; |
| 56 virtual GURL GetLearnMoreUrl() const OVERRIDE; |
| 57 virtual string16 GetActionButtonLabel() const OVERRIDE; |
| 58 virtual string16 GetDismissButtonLabel() const OVERRIDE; |
| 59 virtual bool ShouldShowExtensionList() const OVERRIDE; |
| 60 virtual void LogExtensionCount(size_t count) OVERRIDE; |
| 61 virtual void LogAction( |
| 62 ExtensionMessageBubbleController::BubbleAction action) OVERRIDE; |
| 63 |
| 64 private: |
| 65 friend class ProfileKeyedAPIFactory<DevModeBubbleControllerDelegate>; |
| 66 |
| 67 // ProfileKeyedAPI implementation. |
| 68 static const char* service_name() { |
| 69 return "DevModeBubbleControllerDelegate"; |
| 70 } |
| 71 static const bool kServiceRedirectedInIncognito = true; |
| 72 |
| 73 scoped_ptr<ExtensionMessageBubbleController> controller_; |
| 74 |
| 75 // Our extension service. Weak, not owned by us. |
| 76 ExtensionService* service_; |
| 77 |
| 78 // A weak pointer to the profile we are associated with. Not owned by us. |
| 79 Profile* profile_; |
| 80 |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(DevModeBubbleControllerDelegate); |
| 83 }; |
| 84 |
| 85 template <> |
| 86 void ProfileKeyedAPIFactory< |
| 87 DevModeBubbleControllerDelegate>::DeclareFactoryDependencies(); |
| 88 |
| 89 } // namespace extensions |
| 90 |
| 91 #endif // CHROME_BROWSER_EXTENSIONS_DEV_MODE_BUBBLE_CONTROLLER_DELEGATE_H_ |
OLD | NEW |