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

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

Issue 10443105: Take 2 at implementing activeTab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: many more tests 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_EXTENSION_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "chrome/browser/extensions/active_tab_permission_manager.h"
12 #include "chrome/browser/extensions/app_notify_channel_setup.h" 13 #include "chrome/browser/extensions/app_notify_channel_setup.h"
13 #include "chrome/browser/extensions/extension_function_dispatcher.h" 14 #include "chrome/browser/extensions/extension_function_dispatcher.h"
14 #include "chrome/browser/extensions/image_loading_tracker.h" 15 #include "chrome/browser/extensions/image_loading_tracker.h"
15 #include "chrome/browser/extensions/webstore_inline_installer.h" 16 #include "chrome/browser/extensions/webstore_inline_installer.h"
16 #include "chrome/common/web_apps.h" 17 #include "chrome/common/web_apps.h"
17 #include "content/public/browser/web_contents_observer.h" 18 #include "content/public/browser/web_contents_observer.h"
18 #include "third_party/skia/include/core/SkBitmap.h" 19 #include "third_party/skia/include/core/SkBitmap.h"
19 20
20 class ExtensionTabHelperDelegate; 21 class ExtensionTabHelperDelegate;
21 class TabContents; 22 class TabContents;
(...skipping 30 matching lines...) Expand all
52 void set_delegate(ExtensionTabHelperDelegate* d) { delegate_ = d; } 53 void set_delegate(ExtensionTabHelperDelegate* d) { delegate_ = d; }
53 54
54 // Call this after updating a page action to notify clients about the changes. 55 // Call this after updating a page action to notify clients about the changes.
55 void PageActionStateChanged(); 56 void PageActionStateChanged();
56 57
57 // Requests application info for the specified page. This is an asynchronous 58 // Requests application info for the specified page. This is an asynchronous
58 // request. The delegate is notified by way of OnDidGetApplicationInfo when 59 // request. The delegate is notified by way of OnDidGetApplicationInfo when
59 // the data is available. 60 // the data is available.
60 void GetApplicationInfo(int32 page_id); 61 void GetApplicationInfo(int32 page_id);
61 62
63 // Gets the ID of the tab.
64 int GetTabId() const;
65
66 // Gets the window ID of the tab.
67 int GetWindowId() const;
68
62 // App extensions ------------------------------------------------------------ 69 // App extensions ------------------------------------------------------------
63 70
64 // Sets the extension denoting this as an app. If |extension| is non-null this 71 // Sets the extension denoting this as an app. If |extension| is non-null this
65 // tab becomes an app-tab. WebContents does not listen for unload events for 72 // tab becomes an app-tab. WebContents does not listen for unload events for
66 // the extension. It's up to consumers of WebContents to do that. 73 // the extension. It's up to consumers of WebContents to do that.
67 // 74 //
68 // NOTE: this should only be manipulated before the tab is added to a browser. 75 // NOTE: this should only be manipulated before the tab is added to a browser.
69 // TODO(sky): resolve if this is the right way to identify an app tab. If it 76 // TODO(sky): resolve if this is the right way to identify an app tab. If it
70 // is, than this should be passed in the constructor. 77 // is, than this should be passed in the constructor.
71 void SetExtensionApp(const extensions::Extension* extension); 78 void SetExtensionApp(const extensions::Extension* extension);
(...skipping 24 matching lines...) Expand all
96 } 103 }
97 104
98 content::WebContents* web_contents() const { 105 content::WebContents* web_contents() const {
99 return content::WebContentsObserver::web_contents(); 106 return content::WebContentsObserver::web_contents();
100 } 107 }
101 108
102 extensions::ScriptExecutor* script_executor(); 109 extensions::ScriptExecutor* script_executor();
103 110
104 extensions::LocationBarController* location_bar_controller(); 111 extensions::LocationBarController* location_bar_controller();
105 112
113 extensions::ActiveTabPermissionManager* active_tab_permission_manager() {
114 return &active_tab_permission_manager_;
115 }
116
106 // Sets a non-extension app icon associated with WebContents and fires an 117 // Sets a non-extension app icon associated with WebContents and fires an
107 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title. 118 // INVALIDATE_TYPE_TITLE navigation state change to trigger repaint of title.
108 void SetAppIcon(const SkBitmap& app_icon); 119 void SetAppIcon(const SkBitmap& app_icon);
109 120
110 private: 121 private:
111 // content::WebContentsObserver overrides. 122 // content::WebContentsObserver overrides.
123 virtual void RenderViewCreated(content::RenderViewHost* render_view_host)
Aaron Boodman 2012/06/08 05:31:30 Weird to have OVERRIDE on line by itself. Consider
not at google - send to devlin 2012/06/12 20:40:51 ok.
124 OVERRIDE;
112 virtual void DidNavigateMainFrame( 125 virtual void DidNavigateMainFrame(
113 const content::LoadCommittedDetails& details, 126 const content::LoadCommittedDetails& details,
114 const content::FrameNavigateParams& params) OVERRIDE; 127 const content::FrameNavigateParams& params) OVERRIDE;
115 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 128 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
116 129
117 // ExtensionFunctionDispatcher::Delegate overrides. 130 // ExtensionFunctionDispatcher::Delegate overrides.
118 virtual ExtensionWindowController* GetExtensionWindowController() 131 virtual ExtensionWindowController* GetExtensionWindowController()
119 const OVERRIDE; 132 const OVERRIDE;
120 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; 133 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE;
121 134
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 203
191 TabContentsWrapper* wrapper_; 204 TabContentsWrapper* wrapper_;
192 205
193 // Either script_executor/location_bar_controller will have values, or 206 // Either script_executor/location_bar_controller will have values, or
194 // script_badge_controller will have a value, depending on whether the action 207 // script_badge_controller will have a value, depending on whether the action
195 // box is turned on. 208 // box is turned on.
196 scoped_ptr<extensions::ScriptExecutor> script_executor_; 209 scoped_ptr<extensions::ScriptExecutor> script_executor_;
197 scoped_ptr<extensions::LocationBarController> location_bar_controller_; 210 scoped_ptr<extensions::LocationBarController> location_bar_controller_;
198 scoped_refptr<extensions::ScriptBadgeController> script_badge_controller_; 211 scoped_refptr<extensions::ScriptBadgeController> script_badge_controller_;
199 212
213 extensions::ActiveTabPermissionManager active_tab_permission_manager_;
214
200 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper); 215 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper);
201 }; 216 };
202 217
203 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ 218 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698