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

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

Issue 385061: experimental.popup support for tab-content-viewed extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_dom_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_DOM_UI_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_DOM_UI_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DOM_UI_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DOM_UI_H_
7 7
8 #include <string>
9
8 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
9 #include "chrome/browser/dom_ui/dom_ui.h" 11 #include "chrome/browser/dom_ui/dom_ui.h"
10 #include "chrome/browser/extensions/extension_function_dispatcher.h" 12 #include "chrome/browser/extensions/extension_function_dispatcher.h"
13 #include "chrome/browser/extensions/extension_popup_host.h"
11 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
12 15
13 class ListValue; 16 class ListValue;
14 class PrefService; 17 class PrefService;
18 class RenderViewHost;
15 class TabContents; 19 class TabContents;
16 20
17 // This class implements DOMUI for extensions and allows extensions to put UI in 21 // This class implements DOMUI for extensions and allows extensions to put UI in
18 // the main tab contents area. 22 // the main tab contents area.
19 class ExtensionDOMUI 23 class ExtensionDOMUI
20 : public DOMUI, 24 : public DOMUI,
25 public ExtensionPopupHost::PopupDelegate,
21 public ExtensionFunctionDispatcher::Delegate { 26 public ExtensionFunctionDispatcher::Delegate {
22 public: 27 public:
23 explicit ExtensionDOMUI(TabContents* tab_contents); 28 explicit ExtensionDOMUI(TabContents* tab_contents);
24 29
25 ExtensionFunctionDispatcher* extension_function_dispatcher() const { 30 ExtensionFunctionDispatcher* extension_function_dispatcher() const {
26 return extension_function_dispatcher_.get(); 31 return extension_function_dispatcher_.get();
27 } 32 }
28 33
29 // DOMUI 34 // DOMUI
30 virtual void RenderViewCreated(RenderViewHost* render_view_host); 35 virtual void RenderViewCreated(RenderViewHost* render_view_host);
31 virtual void RenderViewReused(RenderViewHost* render_view_host); 36 virtual void RenderViewReused(RenderViewHost* render_view_host);
32 virtual void ProcessDOMUIMessage(const std::string& message, 37 virtual void ProcessDOMUIMessage(const std::string& message,
33 const Value* content, 38 const Value* content,
34 int request_id, 39 int request_id,
35 bool has_callback); 40 bool has_callback);
36 41
37 // ExtensionFunctionDispatcher::Delegate 42 // ExtensionFunctionDispatcher::Delegate
38 virtual Browser* GetBrowser(); 43 virtual Browser* GetBrowser();
44 virtual ExtensionDOMUI* GetExtensionDOMUI() { return this; }
45
46 // ExtensionPopupHost::Delegate
47 virtual RenderViewHost* GetRenderViewHost();
39 48
40 // BrowserURLHandler 49 // BrowserURLHandler
41 static bool HandleChromeURLOverride(GURL* url, Profile* profile); 50 static bool HandleChromeURLOverride(GURL* url, Profile* profile);
42 51
43 // Register and unregister a dictionary of one or more overrides. 52 // Register and unregister a dictionary of one or more overrides.
44 // Page names are the keys, and chrome-extension: URLs are the values. 53 // Page names are the keys, and chrome-extension: URLs are the values.
45 // (e.g. { "newtab": "chrome-extension://<id>/my_new_tab.html" } 54 // (e.g. { "newtab": "chrome-extension://<id>/my_new_tab.html" }
46 static void RegisterChromeURLOverrides(Profile* profile, 55 static void RegisterChromeURLOverrides(Profile* profile,
47 const Extension::URLOverrideMap& overrides); 56 const Extension::URLOverrideMap& overrides);
48 static void UnregisterChromeURLOverrides(Profile* profile, 57 static void UnregisterChromeURLOverrides(Profile* profile,
(...skipping 15 matching lines...) Expand all
64 73
65 // When the RenderViewHost changes (RenderViewCreated and RenderViewReused), 74 // When the RenderViewHost changes (RenderViewCreated and RenderViewReused),
66 // we need to reset the ExtensionFunctionDispatcher so it's talking to the 75 // we need to reset the ExtensionFunctionDispatcher so it's talking to the
67 // right one, as well as being linked to the correct URL. 76 // right one, as well as being linked to the correct URL.
68 void ResetExtensionFunctionDispatcher(RenderViewHost* render_view_host); 77 void ResetExtensionFunctionDispatcher(RenderViewHost* render_view_host);
69 78
70 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; 79 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
71 }; 80 };
72 81
73 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DOM_UI_H_ 82 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DOM_UI_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_dom_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698