Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: chrome/browser/extensions/script_badge_controller.h

Issue 10535077: TabContentsWrapper -> TabContents, part 12. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SCRIPT_BADGE_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_SCRIPT_BADGE_CONTROLLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_SCRIPT_BADGE_CONTROLLER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_SCRIPT_BADGE_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "chrome/browser/extensions/location_bar_controller.h" 16 #include "chrome/browser/extensions/location_bar_controller.h"
17 #include "chrome/browser/extensions/script_executor.h" 17 #include "chrome/browser/extensions/script_executor.h"
18 #include "chrome/browser/extensions/script_executor_impl.h" 18 #include "chrome/browser/extensions/script_executor_impl.h"
19 #include "content/public/browser/web_contents_observer.h" 19 #include "content/public/browser/web_contents_observer.h"
20 20
21 class ExtensionAction; 21 class ExtensionAction;
22 class ExtensionService; 22 class ExtensionService;
23 class TabContents; 23 class TabContents;
24 typedef TabContents TabContentsWrapper;
25 24
26 namespace IPC { 25 namespace IPC {
27 class Message; 26 class Message;
28 } 27 }
29 28
30 namespace extensions { 29 namespace extensions {
31 30
32 class Extension; 31 class Extension;
33 32
34 // A LocationBarController which displays icons whenever a script is executing 33 // A LocationBarController which displays icons whenever a script is executing
35 // in a tab. It accomplishes this two different ways: 34 // in a tab. It accomplishes this two different ways:
36 // 35 //
37 // - For content_script declarations, this receives IPCs from the renderer 36 // - For content_script declarations, this receives IPCs from the renderer
38 // notifying that a content script is running (either on this tab or one of 37 // notifying that a content script is running (either on this tab or one of
39 // its frames), which is recorded. 38 // its frames), which is recorded.
40 // - The ScriptExecutor interface is exposed for programmatically executing 39 // - The ScriptExecutor interface is exposed for programmatically executing
41 // scripts. Successfully executed scripts are recorded. 40 // scripts. Successfully executed scripts are recorded.
42 // 41 //
43 // When extension IDs are recorded a NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED 42 // When extension IDs are recorded a NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED
44 // is sent, and those extensions will be returned from GetCurrentActions until 43 // is sent, and those extensions will be returned from GetCurrentActions until
45 // the next page navigation. 44 // the next page navigation.
46 // 45 //
47 // Ref-counted so that it can be safely bound in a base::Bind. 46 // Ref-counted so that it can be safely bound in a base::Bind.
48 class ScriptBadgeController 47 class ScriptBadgeController
49 : public base::RefCountedThreadSafe<ScriptBadgeController>, 48 : public base::RefCountedThreadSafe<ScriptBadgeController>,
50 public LocationBarController, 49 public LocationBarController,
51 public ScriptExecutor, 50 public ScriptExecutor,
52 public content::WebContentsObserver { 51 public content::WebContentsObserver {
53 public: 52 public:
54 explicit ScriptBadgeController(TabContentsWrapper* tab_contents); 53 explicit ScriptBadgeController(TabContents* tab_contents);
55 54
56 // LocationBarController implementation. 55 // LocationBarController implementation.
57 virtual scoped_ptr<std::vector<ExtensionAction*> > GetCurrentActions() 56 virtual scoped_ptr<std::vector<ExtensionAction*> > GetCurrentActions()
58 OVERRIDE; 57 OVERRIDE;
59 virtual Action OnClicked(const std::string& extension_id, 58 virtual Action OnClicked(const std::string& extension_id,
60 int mouse_button) OVERRIDE; 59 int mouse_button) OVERRIDE;
61 60
62 // ScriptExecutor implementation. 61 // ScriptExecutor implementation.
63 virtual void ExecuteScript(const std::string& extension_id, 62 virtual void ExecuteScript(const std::string& extension_id,
64 ScriptType script_type, 63 ScriptType script_type,
(...skipping 30 matching lines...) Expand all
95 const content::FrameNavigateParams& params) OVERRIDE; 94 const content::FrameNavigateParams& params) OVERRIDE;
96 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 95 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
97 96
98 // IPC::Message handlers. 97 // IPC::Message handlers.
99 void OnContentScriptsExecuting(const std::set<std::string>& extension_ids, 98 void OnContentScriptsExecuting(const std::set<std::string>& extension_ids,
100 int32 page_id); 99 int32 page_id);
101 100
102 // Delegate ScriptExecutorImpl for running ExecuteScript. 101 // Delegate ScriptExecutorImpl for running ExecuteScript.
103 ScriptExecutorImpl script_executor_; 102 ScriptExecutorImpl script_executor_;
104 103
105 // Our parent TabContentsWrapper. 104 // Our parent TabContents.
106 TabContentsWrapper* tab_contents_; 105 TabContents* tab_contents_;
107 106
108 // The extensions that have called ExecuteScript on the current frame. 107 // The extensions that have called ExecuteScript on the current frame.
109 std::set<std::string> extensions_executing_scripts_; 108 std::set<std::string> extensions_executing_scripts_;
110 109
111 DISALLOW_COPY_AND_ASSIGN(ScriptBadgeController); 110 DISALLOW_COPY_AND_ASSIGN(ScriptBadgeController);
112 }; 111 };
113 112
114 } // namespace extensions 113 } // namespace extensions
115 114
116 #endif // CHROME_BROWSER_EXTENSIONS_SCRIPT_BADGE_CONTROLLER_H_ 115 #endif // CHROME_BROWSER_EXTENSIONS_SCRIPT_BADGE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/process_management_browsertest.cc ('k') | chrome/browser/extensions/script_badge_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698