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

Side by Side Diff: chrome/renderer/extensions/extension_helper.h

Issue 6874038: Remove the last Chrome dependencies from renderer, and enforce no more includes through DEPS. I ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_
6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
11 #include "chrome/common/view_types.h"
11 #include "content/renderer/render_view.h" 12 #include "content/renderer/render_view.h"
12 #include "content/renderer/render_view_observer.h" 13 #include "content/renderer/render_view_observer.h"
13 #include "content/renderer/render_view_observer_tracker.h" 14 #include "content/renderer/render_view_observer_tracker.h"
14 15
15 class ExtensionDispatcher; 16 class ExtensionDispatcher;
16 class GURL; 17 class GURL;
17 class ListValue; 18 class ListValue;
18 struct ExtensionMsg_ExecuteCode_Params; 19 struct ExtensionMsg_ExecuteCode_Params;
19 struct WebApplicationInfo; 20 struct WebApplicationInfo;
20 21
21 namespace webkit_glue { 22 namespace webkit_glue {
22 class ResourceFetcher; 23 class ResourceFetcher;
23 } 24 }
24 25
25 // Filters extension related messages sent to RenderViews. 26 // Filters extension related messages sent to RenderViews.
26 class ExtensionHelper : public RenderViewObserver, 27 class ExtensionHelper : public RenderViewObserver,
27 public RenderViewObserverTracker<ExtensionHelper> { 28 public RenderViewObserverTracker<ExtensionHelper> {
28 public: 29 public:
29 ExtensionHelper(RenderView* render_view, 30 ExtensionHelper(RenderView* render_view,
30 ExtensionDispatcher* extension_dispatcher); 31 ExtensionDispatcher* extension_dispatcher);
31 virtual ~ExtensionHelper(); 32 virtual ~ExtensionHelper();
32 33
33 // Starts installation of the page in the specified frame as a web app. The 34 // Starts installation of the page in the specified frame as a web app. The
34 // page must link to an external 'definition file'. This is different from 35 // page must link to an external 'definition file'. This is different from
35 // the 'application shortcuts' feature where we pull the application 36 // the 'application shortcuts' feature where we pull the application
36 // definition out of optional meta tags in the page. 37 // definition out of optional meta tags in the page.
37 bool InstallWebApplicationUsingDefinitionFile(WebKit::WebFrame* frame, 38 bool InstallWebApplicationUsingDefinitionFile(WebKit::WebFrame* frame,
38 string16* error); 39 string16* error);
39 40
41 int browser_window_id() const { return browser_window_id_; }
42 ViewType::Type view_type() const { return view_type_; }
43
40 private: 44 private:
41 // RenderViewObserver implementation. 45 // RenderViewObserver implementation.
42 virtual bool OnMessageReceived(const IPC::Message& message); 46 virtual bool OnMessageReceived(const IPC::Message& message);
43 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame); 47 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame);
44 virtual void DidFinishLoad(WebKit::WebFrame* frame); 48 virtual void DidFinishLoad(WebKit::WebFrame* frame);
45 virtual void DidCreateDocumentElement(WebKit::WebFrame* frame); 49 virtual void DidCreateDocumentElement(WebKit::WebFrame* frame);
46 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame); 50 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame);
47 virtual void FrameDetached(WebKit::WebFrame* frame); 51 virtual void FrameDetached(WebKit::WebFrame* frame);
48 virtual void DidCreateDataSource(WebKit::WebFrame* frame, 52 virtual void DidCreateDataSource(WebKit::WebFrame* frame,
49 WebKit::WebDataSource* ds); 53 WebKit::WebDataSource* ds);
50 54
51 void OnExtensionResponse(int request_id, bool success, 55 void OnExtensionResponse(int request_id, bool success,
52 const std::string& response, 56 const std::string& response,
53 const std::string& error); 57 const std::string& error);
54 void OnExtensionMessageInvoke(const std::string& extension_id, 58 void OnExtensionMessageInvoke(const std::string& extension_id,
55 const std::string& function_name, 59 const std::string& function_name,
56 const ListValue& args, 60 const ListValue& args,
57 const GURL& event_url); 61 const GURL& event_url);
58 void OnExecuteCode(const ExtensionMsg_ExecuteCode_Params& params); 62 void OnExecuteCode(const ExtensionMsg_ExecuteCode_Params& params);
59 void OnGetApplicationInfo(int page_id); 63 void OnGetApplicationInfo(int page_id);
64 void OnNotifyRendererViewType(ViewType::Type view_type);
65 void OnUpdateBrowserWindowId(int window_id);
60 66
61 // Callback triggered when we finish downloading the application definition 67 // Callback triggered when we finish downloading the application definition
62 // file. 68 // file.
63 void DidDownloadApplicationDefinition(const WebKit::WebURLResponse& response, 69 void DidDownloadApplicationDefinition(const WebKit::WebURLResponse& response,
64 const std::string& data); 70 const std::string& data);
65 71
66 // Callback triggered after each icon referenced by the application definition 72 // Callback triggered after each icon referenced by the application definition
67 // is downloaded. 73 // is downloaded.
68 void DidDownloadApplicationIcon(webkit_glue::ImageResourceFetcher* fetcher, 74 void DidDownloadApplicationIcon(webkit_glue::ImageResourceFetcher* fetcher,
69 const SkBitmap& image); 75 const SkBitmap& image);
(...skipping 11 matching lines...) Expand all
81 // Used to download the application definition file. 87 // Used to download the application definition file.
82 scoped_ptr<webkit_glue::ResourceFetcher> app_definition_fetcher_; 88 scoped_ptr<webkit_glue::ResourceFetcher> app_definition_fetcher_;
83 89
84 // Used to download the icons for an application. 90 // Used to download the icons for an application.
85 RenderView::ImageResourceFetcherList app_icon_fetchers_; 91 RenderView::ImageResourceFetcherList app_icon_fetchers_;
86 92
87 // The number of app icon requests outstanding. When this reaches zero, we're 93 // The number of app icon requests outstanding. When this reaches zero, we're
88 // done processing an app definition file. 94 // done processing an app definition file.
89 int pending_app_icon_requests_; 95 int pending_app_icon_requests_;
90 96
97 // Type of view attached with RenderView.
98 ViewType::Type view_type_;
99
100 // Id number of browser window which RenderView is attached to.
101 int browser_window_id_;
102
91 DISALLOW_COPY_AND_ASSIGN(ExtensionHelper); 103 DISALLOW_COPY_AND_ASSIGN(ExtensionHelper);
92 }; 104 };
93 105
94 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_ 106 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698