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

Side by Side Diff: extensions/renderer/extension_frame_helper.cc

Issue 1200503002: [Extensions] Kill off ExtensionMsg_AddMessageToConsole (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/renderer/extension_frame_helper.h" 5 #include "extensions/renderer/extension_frame_helper.h"
6 6
7 #include "content/public/renderer/render_frame.h" 7 #include "content/public/renderer/render_frame.h"
8 #include "extensions/common/api/messaging/message.h" 8 #include "extensions/common/api/messaging/message.h"
9 #include "extensions/common/constants.h" 9 #include "extensions/common/constants.h"
10 #include "extensions/common/extension_messages.h" 10 #include "extensions/common/extension_messages.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 // static 92 // static
93 bool ExtensionFrameHelper::IsContextForEventPage(const ScriptContext* context) { 93 bool ExtensionFrameHelper::IsContextForEventPage(const ScriptContext* context) {
94 content::RenderFrame* render_frame = context->GetRenderFrame(); 94 content::RenderFrame* render_frame = context->GetRenderFrame();
95 return context->extension() && render_frame && 95 return context->extension() && render_frame &&
96 BackgroundInfo::HasLazyBackgroundPage(context->extension()) && 96 BackgroundInfo::HasLazyBackgroundPage(context->extension()) &&
97 ExtensionFrameHelper::Get(render_frame)->view_type() == 97 ExtensionFrameHelper::Get(render_frame)->view_type() ==
98 VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; 98 VIEW_TYPE_EXTENSION_BACKGROUND_PAGE;
99 } 99 }
100 100
101 // static
102 content::RenderFrame* ExtensionFrameHelper::RenderFrameForContext(
103 const ScriptContext* context) {
104 for (const ExtensionFrameHelper* helper : g_frame_helpers.Get()) {
105 if (context->GetRenderFrame() == helper->render_frame())
106 return helper->render_frame();
107 }
108 return nullptr;
109 }
110
101 void ExtensionFrameHelper::DidCreateScriptContext( 111 void ExtensionFrameHelper::DidCreateScriptContext(
102 v8::Local<v8::Context> context, 112 v8::Local<v8::Context> context,
103 int extension_group, 113 int extension_group,
104 int world_id) { 114 int world_id) {
105 extension_dispatcher_->DidCreateScriptContext( 115 extension_dispatcher_->DidCreateScriptContext(
106 render_frame()->GetWebFrame(), context, extension_group, world_id); 116 render_frame()->GetWebFrame(), context, extension_group, world_id);
107 } 117 }
108 118
109 void ExtensionFrameHelper::WillReleaseScriptContext( 119 void ExtensionFrameHelper::WillReleaseScriptContext(
110 v8::Local<v8::Context> context, 120 v8::Local<v8::Context> context,
111 int world_id) { 121 int world_id) {
112 extension_dispatcher_->WillReleaseScriptContext( 122 extension_dispatcher_->WillReleaseScriptContext(
113 render_frame()->GetWebFrame(), context, world_id); 123 render_frame()->GetWebFrame(), context, world_id);
114 } 124 }
115 125
116 bool ExtensionFrameHelper::OnMessageReceived(const IPC::Message& message) { 126 bool ExtensionFrameHelper::OnMessageReceived(const IPC::Message& message) {
117 bool handled = true; 127 bool handled = true;
118 IPC_BEGIN_MESSAGE_MAP(ExtensionFrameHelper, message) 128 IPC_BEGIN_MESSAGE_MAP(ExtensionFrameHelper, message)
119 IPC_MESSAGE_HANDLER(ExtensionMsg_AddMessageToConsole,
120 OnAddMessageToConsole)
121 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnConnect, 129 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnConnect,
122 OnExtensionDispatchOnConnect) 130 OnExtensionDispatchOnConnect)
123 IPC_MESSAGE_HANDLER(ExtensionMsg_DeliverMessage, OnExtensionDeliverMessage) 131 IPC_MESSAGE_HANDLER(ExtensionMsg_DeliverMessage, OnExtensionDeliverMessage)
124 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnDisconnect, 132 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnDisconnect,
125 OnExtensionDispatchOnDisconnect) 133 OnExtensionDispatchOnDisconnect)
126 IPC_MESSAGE_HANDLER(ExtensionMsg_SetTabId, OnExtensionSetTabId) 134 IPC_MESSAGE_HANDLER(ExtensionMsg_SetTabId, OnExtensionSetTabId)
127 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId, 135 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId,
128 OnUpdateBrowserWindowId) 136 OnUpdateBrowserWindowId)
129 IPC_MESSAGE_HANDLER(ExtensionMsg_SetMainFrameExtensionOwner, 137 IPC_MESSAGE_HANDLER(ExtensionMsg_SetMainFrameExtensionOwner,
130 OnSetMainFrameExtensionOwner) 138 OnSetMainFrameExtensionOwner)
131 IPC_MESSAGE_HANDLER(ExtensionMsg_NotifyRenderViewType, 139 IPC_MESSAGE_HANDLER(ExtensionMsg_NotifyRenderViewType,
132 OnNotifyRendererViewType) 140 OnNotifyRendererViewType)
133 IPC_MESSAGE_HANDLER(ExtensionMsg_Response, OnExtensionResponse) 141 IPC_MESSAGE_HANDLER(ExtensionMsg_Response, OnExtensionResponse)
134 IPC_MESSAGE_UNHANDLED(handled = false) 142 IPC_MESSAGE_UNHANDLED(handled = false)
135 IPC_END_MESSAGE_MAP() 143 IPC_END_MESSAGE_MAP()
136 return handled; 144 return handled;
137 } 145 }
138 146
139 void ExtensionFrameHelper::OnAddMessageToConsole(
140 content::ConsoleMessageLevel level,
141 const std::string& message) {
142 console::AddMessage(render_frame()->GetRenderView(), level, message);
143 }
144
145 void ExtensionFrameHelper::OnExtensionDispatchOnConnect( 147 void ExtensionFrameHelper::OnExtensionDispatchOnConnect(
146 int target_port_id, 148 int target_port_id,
147 const std::string& channel_name, 149 const std::string& channel_name,
148 const ExtensionMsg_TabConnectionInfo& source, 150 const ExtensionMsg_TabConnectionInfo& source,
149 const ExtensionMsg_ExternalConnectionInfo& info, 151 const ExtensionMsg_ExternalConnectionInfo& info,
150 const std::string& tls_channel_id) { 152 const std::string& tls_channel_id) {
151 MessagingBindings::DispatchOnConnect( 153 MessagingBindings::DispatchOnConnect(
152 extension_dispatcher_->script_context_set(), 154 extension_dispatcher_->script_context_set(),
153 target_port_id, 155 target_port_id,
154 channel_name, 156 channel_name,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 bool success, 200 bool success,
199 const base::ListValue& response, 201 const base::ListValue& response,
200 const std::string& error) { 202 const std::string& error) {
201 extension_dispatcher_->OnExtensionResponse(request_id, 203 extension_dispatcher_->OnExtensionResponse(request_id,
202 success, 204 success,
203 response, 205 response,
204 error); 206 error);
205 } 207 }
206 208
207 } // namespace extensions 209 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698