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

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

Issue 10443105: Take 2 at implementing activeTab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: empty -> is_empty 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
« no previous file with comments | « chrome/renderer/extensions/extension_helper.h ('k') | chrome/renderer/extensions/tab_finder.h » ('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) 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 #include "chrome/renderer/extensions/extension_helper.h" 5 #include "chrome/renderer/extensions/extension_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 return accumulator.views()[0]; 137 return accumulator.views()[0];
138 } 138 }
139 139
140 ExtensionHelper::ExtensionHelper(content::RenderView* render_view, 140 ExtensionHelper::ExtensionHelper(content::RenderView* render_view,
141 ExtensionDispatcher* extension_dispatcher) 141 ExtensionDispatcher* extension_dispatcher)
142 : content::RenderViewObserver(render_view), 142 : content::RenderViewObserver(render_view),
143 content::RenderViewObserverTracker<ExtensionHelper>(render_view), 143 content::RenderViewObserverTracker<ExtensionHelper>(render_view),
144 extension_dispatcher_(extension_dispatcher), 144 extension_dispatcher_(extension_dispatcher),
145 pending_app_icon_requests_(0), 145 pending_app_icon_requests_(0),
146 view_type_(chrome::VIEW_TYPE_INVALID), 146 view_type_(chrome::VIEW_TYPE_INVALID),
147 tab_id_(-1),
147 browser_window_id_(-1) { 148 browser_window_id_(-1) {
148 } 149 }
149 150
150 ExtensionHelper::~ExtensionHelper() { 151 ExtensionHelper::~ExtensionHelper() {
151 } 152 }
152 153
153 bool ExtensionHelper::InstallWebApplicationUsingDefinitionFile( 154 bool ExtensionHelper::InstallWebApplicationUsingDefinitionFile(
154 WebFrame* frame, string16* error) { 155 WebFrame* frame, string16* error) {
155 // There is an issue of drive-by installs with the below implementation. A web 156 // There is an issue of drive-by installs with the below implementation. A web
156 // site could force a user to install an app by timing the dialog to come up 157 // site could force a user to install an app by timing the dialog to come up
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 IPC_BEGIN_MESSAGE_MAP(ExtensionHelper, message) 203 IPC_BEGIN_MESSAGE_MAP(ExtensionHelper, message)
203 IPC_MESSAGE_HANDLER(ExtensionMsg_Response, OnExtensionResponse) 204 IPC_MESSAGE_HANDLER(ExtensionMsg_Response, OnExtensionResponse)
204 IPC_MESSAGE_HANDLER(ExtensionMsg_MessageInvoke, OnExtensionMessageInvoke) 205 IPC_MESSAGE_HANDLER(ExtensionMsg_MessageInvoke, OnExtensionMessageInvoke)
205 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnConnect, 206 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnConnect,
206 OnExtensionDispatchOnConnect) 207 OnExtensionDispatchOnConnect)
207 IPC_MESSAGE_HANDLER(ExtensionMsg_DeliverMessage, OnExtensionDeliverMessage) 208 IPC_MESSAGE_HANDLER(ExtensionMsg_DeliverMessage, OnExtensionDeliverMessage)
208 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnDisconnect, 209 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnDisconnect,
209 OnExtensionDispatchOnDisconnect) 210 OnExtensionDispatchOnDisconnect)
210 IPC_MESSAGE_HANDLER(ExtensionMsg_ExecuteCode, OnExecuteCode) 211 IPC_MESSAGE_HANDLER(ExtensionMsg_ExecuteCode, OnExecuteCode)
211 IPC_MESSAGE_HANDLER(ExtensionMsg_GetApplicationInfo, OnGetApplicationInfo) 212 IPC_MESSAGE_HANDLER(ExtensionMsg_GetApplicationInfo, OnGetApplicationInfo)
213 IPC_MESSAGE_HANDLER(ExtensionMsg_SetTabId, OnSetTabId)
212 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId, 214 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId,
213 OnUpdateBrowserWindowId) 215 OnUpdateBrowserWindowId)
214 IPC_MESSAGE_HANDLER(ExtensionMsg_NotifyRenderViewType, 216 IPC_MESSAGE_HANDLER(ExtensionMsg_NotifyRenderViewType,
215 OnNotifyRendererViewType) 217 OnNotifyRendererViewType)
216 IPC_MESSAGE_UNHANDLED(handled = false) 218 IPC_MESSAGE_UNHANDLED(handled = false)
217 IPC_END_MESSAGE_MAP() 219 IPC_END_MESSAGE_MAP()
218 return handled; 220 return handled;
219 } 221 }
220 222
221 void ExtensionHelper::DidFinishDocumentLoad(WebFrame* frame) { 223 void ExtensionHelper::DidFinishDocumentLoad(WebFrame* frame) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 368 }
367 369
368 Send(new ExtensionHostMsg_DidGetApplicationInfo( 370 Send(new ExtensionHostMsg_DidGetApplicationInfo(
369 routing_id(), page_id, app_info)); 371 routing_id(), page_id, app_info));
370 } 372 }
371 373
372 void ExtensionHelper::OnNotifyRendererViewType(chrome::ViewType type) { 374 void ExtensionHelper::OnNotifyRendererViewType(chrome::ViewType type) {
373 view_type_ = type; 375 view_type_ = type;
374 } 376 }
375 377
378 void ExtensionHelper::OnSetTabId(int init_tab_id) {
379 CHECK_EQ(tab_id_, -1);
380 CHECK_GE(init_tab_id, 0);
381 tab_id_ = init_tab_id;
382 }
383
376 void ExtensionHelper::OnUpdateBrowserWindowId(int window_id) { 384 void ExtensionHelper::OnUpdateBrowserWindowId(int window_id) {
377 browser_window_id_ = window_id; 385 browser_window_id_ = window_id;
378 } 386 }
379 387
380 void ExtensionHelper::DidDownloadApplicationDefinition( 388 void ExtensionHelper::DidDownloadApplicationDefinition(
381 const WebKit::WebURLResponse& response, 389 const WebKit::WebURLResponse& response,
382 const std::string& data) { 390 const std::string& data) {
383 scoped_ptr<WebApplicationInfo> app_info( 391 scoped_ptr<WebApplicationInfo> app_info(
384 pending_app_info_.release()); 392 pending_app_info_.release());
385 393
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 routing_id(), *pending_app_info_)); 477 routing_id(), *pending_app_info_));
470 pending_app_info_.reset(NULL); 478 pending_app_info_.reset(NULL);
471 } 479 }
472 480
473 void ExtensionHelper::AddErrorToRootConsole(const string16& message) { 481 void ExtensionHelper::AddErrorToRootConsole(const string16& message) {
474 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 482 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
475 render_view()->GetWebView()->mainFrame()->addMessageToConsole( 483 render_view()->GetWebView()->mainFrame()->addMessageToConsole(
476 WebConsoleMessage(WebConsoleMessage::LevelError, message)); 484 WebConsoleMessage(WebConsoleMessage::LevelError, message));
477 } 485 }
478 } 486 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_helper.h ('k') | chrome/renderer/extensions/tab_finder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698