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

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

Issue 1200503002: [Extensions] Kill off ExtensionMsg_AddMessageToConsole (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master 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
« no previous file with comments | « extensions/renderer/extension_helper.h ('k') | extensions/renderer/module_system.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_helper.h" 5 #include "extensions/renderer/extension_helper.h"
6 6
7 #include "content/public/renderer/render_view.h" 7 #include "content/public/renderer/render_view.h"
8 #include "content/public/renderer/render_view_visitor.h" 8 #include "content/public/renderer/render_view_visitor.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 27 matching lines...) Expand all
38 new AutomationApiHelper(render_view); 38 new AutomationApiHelper(render_view);
39 } 39 }
40 40
41 ExtensionHelper::~ExtensionHelper() { 41 ExtensionHelper::~ExtensionHelper() {
42 } 42 }
43 43
44 bool ExtensionHelper::OnMessageReceived(const IPC::Message& message) { 44 bool ExtensionHelper::OnMessageReceived(const IPC::Message& message) {
45 bool handled = true; 45 bool handled = true;
46 IPC_BEGIN_MESSAGE_MAP(ExtensionHelper, message) 46 IPC_BEGIN_MESSAGE_MAP(ExtensionHelper, message)
47 IPC_MESSAGE_HANDLER(ExtensionMsg_SetFrameName, OnSetFrameName) 47 IPC_MESSAGE_HANDLER(ExtensionMsg_SetFrameName, OnSetFrameName)
48 IPC_MESSAGE_HANDLER(ExtensionMsg_AddMessageToConsole,
49 OnAddMessageToConsole)
50 IPC_MESSAGE_HANDLER(ExtensionMsg_AppWindowClosed, 48 IPC_MESSAGE_HANDLER(ExtensionMsg_AppWindowClosed,
51 OnAppWindowClosed) 49 OnAppWindowClosed)
52 IPC_MESSAGE_UNHANDLED(handled = false) 50 IPC_MESSAGE_UNHANDLED(handled = false)
53 IPC_END_MESSAGE_MAP() 51 IPC_END_MESSAGE_MAP()
54 return handled; 52 return handled;
55 } 53 }
56 54
57 void ExtensionHelper::DidCreateDocumentElement(WebLocalFrame* frame) { 55 void ExtensionHelper::DidCreateDocumentElement(WebLocalFrame* frame) {
58 dispatcher_->DidCreateDocumentElement(frame); 56 dispatcher_->DidCreateDocumentElement(frame);
59 } 57 }
(...skipping 18 matching lines...) Expand all
78 dispatcher_->DidMatchCSS( 76 dispatcher_->DidMatchCSS(
79 frame, newly_matching_selectors, stopped_matching_selectors); 77 frame, newly_matching_selectors, stopped_matching_selectors);
80 } 78 }
81 79
82 void ExtensionHelper::OnSetFrameName(const std::string& name) { 80 void ExtensionHelper::OnSetFrameName(const std::string& name) {
83 blink::WebView* web_view = render_view()->GetWebView(); 81 blink::WebView* web_view = render_view()->GetWebView();
84 if (web_view) 82 if (web_view)
85 web_view->mainFrame()->setName(blink::WebString::fromUTF8(name)); 83 web_view->mainFrame()->setName(blink::WebString::fromUTF8(name));
86 } 84 }
87 85
88 void ExtensionHelper::OnAddMessageToConsole(ConsoleMessageLevel level,
89 const std::string& message) {
90 console::AddMessage(render_view(), level, message);
91 }
92
93 void ExtensionHelper::OnAppWindowClosed() { 86 void ExtensionHelper::OnAppWindowClosed() {
94 v8::HandleScope scope(v8::Isolate::GetCurrent()); 87 v8::HandleScope scope(v8::Isolate::GetCurrent());
95 v8::Local<v8::Context> v8_context = 88 v8::Local<v8::Context> v8_context =
96 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); 89 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext();
97 ScriptContext* script_context = 90 ScriptContext* script_context =
98 dispatcher_->script_context_set().GetByV8Context(v8_context); 91 dispatcher_->script_context_set().GetByV8Context(v8_context);
99 if (!script_context) 92 if (!script_context)
100 return; 93 return;
101 script_context->module_system()->CallModuleMethod("app.window", 94 script_context->module_system()->CallModuleMethod("app.window",
102 "onAppWindowClosed"); 95 "onAppWindowClosed");
103 } 96 }
104 97
105 } // namespace extensions 98 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/extension_helper.h ('k') | extensions/renderer/module_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698