Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / suspicious_extension_bubble_controller.h
blob4e8866731376f55b529e959da7b3803b96e9a14b
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_SUSPICIOUS_EXTENSION_BUBBLE_CONTROLLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_SUSPICIOUS_EXTENSION_BUBBLE_CONTROLLER_H_
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 "extensions/common/extension.h"
13 class Browser;
14 class ExtensionService;
16 using extensions::ExtensionMessageBubbleController;
18 namespace {
20 class SuspiciousExtensionBubbleDelegate
21 : public ExtensionMessageBubbleController::Delegate {
22 public:
23 explicit SuspiciousExtensionBubbleDelegate(ExtensionService* service);
24 virtual ~SuspiciousExtensionBubbleDelegate();
26 // ExtensionMessageBubbleController::Delegate methods.
27 virtual bool ShouldIncludeExtension(const std::string& extension_id) OVERRIDE;
28 virtual void AcknowledgeExtension(
29 const std::string& extension_id,
30 ExtensionMessageBubbleController::BubbleAction user_action) OVERRIDE;
31 virtual void PerformAction(const extensions::ExtensionIdList& list) OVERRIDE;
32 virtual base::string16 GetTitle() const OVERRIDE;
33 virtual base::string16 GetMessageBody() const OVERRIDE;
34 virtual base::string16 GetOverflowText(
35 const base::string16& overflow_count) const OVERRIDE;
36 virtual base::string16 GetLearnMoreLabel() const OVERRIDE;
37 virtual GURL GetLearnMoreUrl() const OVERRIDE;
38 virtual base::string16 GetActionButtonLabel() const OVERRIDE;
39 virtual base::string16 GetDismissButtonLabel() const OVERRIDE;
40 virtual bool ShouldShowExtensionList() const OVERRIDE;
41 virtual void LogExtensionCount(size_t count) OVERRIDE;
42 virtual void LogAction(
43 ExtensionMessageBubbleController::BubbleAction action) OVERRIDE;
45 private:
46 // Our extension service. Weak, not owned by us.
47 ExtensionService* service_;
49 DISALLOW_COPY_AND_ASSIGN(SuspiciousExtensionBubbleDelegate);
52 } // namespace
54 namespace extensions {
56 class SuspiciousExtensionBubble;
58 class SuspiciousExtensionBubbleController
59 : public ExtensionMessageBubbleController {
60 public:
61 // Clears the list of profiles the bubble has been shown for. Should only be
62 // used during testing.
63 static void ClearProfileListForTesting();
65 explicit SuspiciousExtensionBubbleController(Profile* profile);
66 virtual ~SuspiciousExtensionBubbleController();
68 // Whether the controller knows of extensions to list in the bubble. Returns
69 // true if so.
70 bool ShouldShow();
72 // ExtensionMessageBubbleController methods.
73 virtual void Show(ExtensionMessageBubble* bubble) OVERRIDE;
75 private:
76 // A weak pointer to the profile we are associated with. Not owned by us.
77 Profile* profile_;
79 DISALLOW_COPY_AND_ASSIGN(SuspiciousExtensionBubbleController);
82 } // namespace extensions
84 #endif // CHROME_BROWSER_EXTENSIONS_SUSPICIOUS_EXTENSION_BUBBLE_CONTROLLER_H_