| OLD | NEW |
| 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 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 external_host_bindings_.set_routing_id(routing_id_); | 2073 external_host_bindings_.set_routing_id(routing_id_); |
| 2074 external_host_bindings_.BindToJavascript(frame, L"externalHost"); | 2074 external_host_bindings_.BindToJavascript(frame, L"externalHost"); |
| 2075 } | 2075 } |
| 2076 } | 2076 } |
| 2077 | 2077 |
| 2078 void RenderView::didCreateDocumentElement(WebFrame* frame) { | 2078 void RenderView::didCreateDocumentElement(WebFrame* frame) { |
| 2079 if (RenderThread::current()) { // Will be NULL during unit tests. | 2079 if (RenderThread::current()) { // Will be NULL during unit tests. |
| 2080 RenderThread::current()->user_script_slave()->InjectScripts( | 2080 RenderThread::current()->user_script_slave()->InjectScripts( |
| 2081 frame, UserScript::DOCUMENT_START); | 2081 frame, UserScript::DOCUMENT_START); |
| 2082 } | 2082 } |
| 2083 if (view_type_ == ViewType::EXTENSION_TOOLSTRIP || |
| 2084 view_type_ == ViewType::EXTENSION_MOLE) { |
| 2085 InjectToolstripCSS(); |
| 2086 ExtensionProcessBindings::SetViewType(webview(), view_type_); |
| 2087 } |
| 2083 | 2088 |
| 2084 while (!pending_code_execution_queue_.empty()) { | 2089 while (!pending_code_execution_queue_.empty()) { |
| 2085 scoped_refptr<CodeExecutionInfo> info = | 2090 scoped_refptr<CodeExecutionInfo> info = |
| 2086 pending_code_execution_queue_.front(); | 2091 pending_code_execution_queue_.front(); |
| 2087 OnExecuteCode(info->request_id, info->extension_id, info->is_js_code, | 2092 OnExecuteCode(info->request_id, info->extension_id, info->is_js_code, |
| 2088 info->code_string); | 2093 info->code_string); |
| 2089 pending_code_execution_queue_.pop(); | 2094 pending_code_execution_queue_.pop(); |
| 2090 } | 2095 } |
| 2091 | 2096 |
| 2092 // Notify the browser about non-blank documents loading in the top frame. | 2097 // Notify the browser about non-blank documents loading in the top frame. |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2967 void RenderView::OnMediaPlayerActionAt(int x, | 2972 void RenderView::OnMediaPlayerActionAt(int x, |
| 2968 int y, | 2973 int y, |
| 2969 const MediaPlayerAction& action) { | 2974 const MediaPlayerAction& action) { |
| 2970 if (!webview()) | 2975 if (!webview()) |
| 2971 return; | 2976 return; |
| 2972 | 2977 |
| 2973 webview()->MediaPlayerActionAt(x, y, action); | 2978 webview()->MediaPlayerActionAt(x, y, action); |
| 2974 } | 2979 } |
| 2975 | 2980 |
| 2976 void RenderView::OnNotifyRendererViewType(ViewType::Type type) { | 2981 void RenderView::OnNotifyRendererViewType(ViewType::Type type) { |
| 2982 // When this is first set, the bindings aren't fully loaded. We only need |
| 2983 // to call through this API after the page has already been loaded. It's |
| 2984 // also called in didCreateDocumentElement to bootstrap. |
| 2985 if (view_type_ != ViewType::INVALID) { |
| 2986 if (type == ViewType::EXTENSION_MOLE || |
| 2987 type == ViewType::EXTENSION_TOOLSTRIP) { |
| 2988 ExtensionProcessBindings::SetViewType(webview(), type); |
| 2989 } |
| 2990 } |
| 2977 view_type_ = type; | 2991 view_type_ = type; |
| 2978 } | 2992 } |
| 2979 | 2993 |
| 2980 void RenderView::OnUpdateBrowserWindowId(int window_id) { | 2994 void RenderView::OnUpdateBrowserWindowId(int window_id) { |
| 2981 browser_window_id_ = window_id; | 2995 browser_window_id_ = window_id; |
| 2982 } | 2996 } |
| 2983 | 2997 |
| 2984 void RenderView::OnUpdateBackForwardListCount(int back_list_count, | 2998 void RenderView::OnUpdateBackForwardListCount(int back_list_count, |
| 2985 int forward_list_count) { | 2999 int forward_list_count) { |
| 2986 history_back_list_count_ = back_list_count; | 3000 history_back_list_count_ = back_list_count; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3242 } | 3256 } |
| 3243 | 3257 |
| 3244 void RenderView::OnExtensionResponse(int request_id, | 3258 void RenderView::OnExtensionResponse(int request_id, |
| 3245 bool success, | 3259 bool success, |
| 3246 const std::string& response, | 3260 const std::string& response, |
| 3247 const std::string& error) { | 3261 const std::string& error) { |
| 3248 ExtensionProcessBindings::HandleResponse( | 3262 ExtensionProcessBindings::HandleResponse( |
| 3249 request_id, success, response, error); | 3263 request_id, success, response, error); |
| 3250 } | 3264 } |
| 3251 | 3265 |
| 3266 void RenderView::InjectToolstripCSS() { |
| 3267 if (view_type_ != ViewType::EXTENSION_TOOLSTRIP) |
| 3268 return; |
| 3269 |
| 3270 static const base::StringPiece toolstrip_css( |
| 3271 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 3272 IDR_EXTENSION_TOOLSTRIP_CSS)); |
| 3273 std::string css = toolstrip_css.as_string(); |
| 3274 InsertCSS(L"", css, "ToolstripDefaultCSS"); |
| 3275 } |
| 3276 |
| 3252 void RenderView::OnExtensionMessageInvoke(const std::string& function_name, | 3277 void RenderView::OnExtensionMessageInvoke(const std::string& function_name, |
| 3253 const ListValue& args) { | 3278 const ListValue& args) { |
| 3254 RendererExtensionBindings::Invoke(function_name, args, this); | 3279 RendererExtensionBindings::Invoke(function_name, args, this); |
| 3255 } | 3280 } |
| 3256 | 3281 |
| 3257 // Dump all load time histograms. | 3282 // Dump all load time histograms. |
| 3258 // | 3283 // |
| 3259 // There are 13 histograms measuring various times. | 3284 // There are 13 histograms measuring various times. |
| 3260 // The time points we keep are | 3285 // The time points we keep are |
| 3261 // request: time document was requested by user | 3286 // request: time document was requested by user |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3547 // TODO(darin): There's actually no reason for this to be here. We should | 3572 // TODO(darin): There's actually no reason for this to be here. We should |
| 3548 // have the browser side manage the document tag. | 3573 // have the browser side manage the document tag. |
| 3549 #if defined(OS_MACOSX) | 3574 #if defined(OS_MACOSX) |
| 3550 if (!has_document_tag_) { | 3575 if (!has_document_tag_) { |
| 3551 // Make the call to get the tag. | 3576 // Make the call to get the tag. |
| 3552 Send(new ViewHostMsg_GetDocumentTag(routing_id_, &document_tag_)); | 3577 Send(new ViewHostMsg_GetDocumentTag(routing_id_, &document_tag_)); |
| 3553 has_document_tag_ = true; | 3578 has_document_tag_ = true; |
| 3554 } | 3579 } |
| 3555 #endif | 3580 #endif |
| 3556 } | 3581 } |
| OLD | NEW |