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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 147033: Refactor extension bindings to share code, avoid exposing hidden variables (Closed)
Patch Set: at head Created 11 years, 5 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 | « chrome/renderer/js_only_v8_extensions.cc ('k') | chrome/renderer/renderer_resources.grd » ('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 #include "chrome/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "chrome/common/page_zoom.h" 29 #include "chrome/common/page_zoom.h"
30 #include "chrome/common/render_messages.h" 30 #include "chrome/common/render_messages.h"
31 #include "chrome/common/renderer_preferences.h" 31 #include "chrome/common/renderer_preferences.h"
32 #include "chrome/common/thumbnail_score.h" 32 #include "chrome/common/thumbnail_score.h"
33 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
34 #include "chrome/renderer/about_handler.h" 34 #include "chrome/renderer/about_handler.h"
35 #include "chrome/renderer/audio_message_filter.h" 35 #include "chrome/renderer/audio_message_filter.h"
36 #include "chrome/renderer/devtools_agent.h" 36 #include "chrome/renderer/devtools_agent.h"
37 #include "chrome/renderer/devtools_client.h" 37 #include "chrome/renderer/devtools_client.h"
38 #include "chrome/renderer/extensions/event_bindings.h" 38 #include "chrome/renderer/extensions/event_bindings.h"
39 #include "chrome/renderer/extensions/extension_process_bindings.h"
40 #include "chrome/renderer/localized_error.h" 39 #include "chrome/renderer/localized_error.h"
41 #include "chrome/renderer/media/audio_renderer_impl.h" 40 #include "chrome/renderer/media/audio_renderer_impl.h"
42 #include "chrome/renderer/media/buffered_data_source.h" 41 #include "chrome/renderer/media/buffered_data_source.h"
43 #include "chrome/renderer/navigation_state.h" 42 #include "chrome/renderer/navigation_state.h"
44 #include "chrome/renderer/print_web_view_helper.h" 43 #include "chrome/renderer/print_web_view_helper.h"
45 #include "chrome/renderer/render_process.h" 44 #include "chrome/renderer/render_process.h"
46 #include "chrome/renderer/renderer_logging.h" 45 #include "chrome/renderer/renderer_logging.h"
47 #include "chrome/renderer/user_script_slave.h" 46 #include "chrome/renderer/user_script_slave.h"
48 #include "chrome/renderer/visitedlink_slave.h" 47 #include "chrome/renderer/visitedlink_slave.h"
49 #include "chrome/renderer/webplugin_delegate_proxy.h" 48 #include "chrome/renderer/webplugin_delegate_proxy.h"
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 } 1450 }
1452 1451
1453 void RenderView::DocumentElementAvailable(WebFrame* frame) { 1452 void RenderView::DocumentElementAvailable(WebFrame* frame) {
1454 // TODO(mpcomplete): remove this before Chrome extensions ship. 1453 // TODO(mpcomplete): remove this before Chrome extensions ship.
1455 // HACK. This is a temporary workaround to allow cross-origin XHR for Chrome 1454 // HACK. This is a temporary workaround to allow cross-origin XHR for Chrome
1456 // extensions. It grants full access to every origin, when we really want 1455 // extensions. It grants full access to every origin, when we really want
1457 // to be able to restrict them more specifically. 1456 // to be able to restrict them more specifically.
1458 if (frame->GetURL().SchemeIs(chrome::kExtensionScheme)) 1457 if (frame->GetURL().SchemeIs(chrome::kExtensionScheme))
1459 frame->GrantUniversalAccess(); 1458 frame->GrantUniversalAccess();
1460 1459
1461 // Tell extensions to self-register their js contexts.
1462 // TODO(rafaelw): This is kind of gross. We need a way to call through
1463 // the glue layer to retrieve the current v8::Context.
1464 if (frame->GetURL().SchemeIs(chrome::kExtensionScheme))
1465 ExtensionProcessBindings::RegisterExtensionContext(frame);
1466
1467 if (RenderThread::current()) // Will be NULL during unit tests. 1460 if (RenderThread::current()) // Will be NULL during unit tests.
1468 RenderThread::current()->user_script_slave()->InjectScripts( 1461 RenderThread::current()->user_script_slave()->InjectScripts(
1469 frame, UserScript::DOCUMENT_START); 1462 frame, UserScript::DOCUMENT_START);
1470 } 1463 }
1471 1464
1472 void RenderView::DidCreateScriptContext(WebFrame* webframe) { 1465 void RenderView::DidCreateScriptContext(WebFrame* webframe) {
1473 EventBindings::HandleContextCreated(webframe); 1466 EventBindings::HandleContextCreated(webframe);
1474 } 1467 }
1475 1468
1476 void RenderView::DidDestroyScriptContext(WebFrame* webframe) { 1469 void RenderView::DidDestroyScriptContext(WebFrame* webframe) {
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 int request_id, 2810 int request_id,
2818 bool has_callback) { 2811 bool has_callback) {
2819 Send(new ViewHostMsg_ExtensionRequest(routing_id_, name, args, request_id, 2812 Send(new ViewHostMsg_ExtensionRequest(routing_id_, name, args, request_id,
2820 has_callback)); 2813 has_callback));
2821 } 2814 }
2822 2815
2823 void RenderView::OnExtensionResponse(int request_id, 2816 void RenderView::OnExtensionResponse(int request_id,
2824 bool success, 2817 bool success,
2825 const std::string& response, 2818 const std::string& response,
2826 const std::string& error) { 2819 const std::string& error) {
2827 ExtensionProcessBindings::HandleResponse(request_id, success, response, 2820 EventBindings::HandleResponse(request_id, success, response, error);
2828 error);
2829 } 2821 }
2830 2822
2831 // Dump all load time histograms. 2823 // Dump all load time histograms.
2832 // 2824 //
2833 // There are 13 histograms measuring various times. 2825 // There are 13 histograms measuring various times.
2834 // The time points we keep are 2826 // The time points we keep are
2835 // request: time document was requested by user 2827 // request: time document was requested by user
2836 // start: time load of document started 2828 // start: time load of document started
2837 // commit: time load of document started 2829 // commit: time load of document started
2838 // finish_document: main document loaded, before onload() 2830 // finish_document: main document loaded, before onload()
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2985 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); 2977 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms));
2986 } 2978 }
2987 2979
2988 void RenderView::Print(WebFrame* frame, bool script_initiated) { 2980 void RenderView::Print(WebFrame* frame, bool script_initiated) {
2989 DCHECK(frame); 2981 DCHECK(frame);
2990 if (print_helper_.get() == NULL) { 2982 if (print_helper_.get() == NULL) {
2991 print_helper_.reset(new PrintWebViewHelper(this)); 2983 print_helper_.reset(new PrintWebViewHelper(this));
2992 } 2984 }
2993 print_helper_->Print(frame, script_initiated); 2985 print_helper_->Print(frame, script_initiated);
2994 } 2986 }
OLDNEW
« no previous file with comments | « chrome/renderer/js_only_v8_extensions.cc ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698