| 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/browser/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 last_search_prepopulate_text_(NULL), | 252 last_search_prepopulate_text_(NULL), |
| 253 last_search_result_(), | 253 last_search_result_(), |
| 254 capturing_contents_(false), | 254 capturing_contents_(false), |
| 255 is_being_destroyed_(false), | 255 is_being_destroyed_(false), |
| 256 notify_disconnection_(false), | 256 notify_disconnection_(false), |
| 257 history_requests_(), | 257 history_requests_(), |
| 258 #if defined(OS_WIN) | 258 #if defined(OS_WIN) |
| 259 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), | 259 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), |
| 260 #endif | 260 #endif |
| 261 last_javascript_message_dismissal_(), | 261 last_javascript_message_dismissal_(), |
| 262 suppress_javascript_messages_(false) { | 262 suppress_javascript_messages_(false), |
| 263 opener_dom_ui_type_(DOMUIFactory::kNoDOMUI) { |
| 263 pending_install_.page_id = 0; | 264 pending_install_.page_id = 0; |
| 264 pending_install_.callback_functor = NULL; | 265 pending_install_.callback_functor = NULL; |
| 265 | 266 |
| 266 #if defined(OS_CHROMEOS) | 267 #if defined(OS_CHROMEOS) |
| 267 // Make sure the thumbnailer is started before starting the render manager. | 268 // Make sure the thumbnailer is started before starting the render manager. |
| 268 // The thumbnailer will want to listen for RVH creations, one of which will | 269 // The thumbnailer will want to listen for RVH creations, one of which will |
| 269 // happen in RVHManager::Init. | 270 // happen in RVHManager::Init. |
| 270 ThumbnailGenerator* generator = g_browser_process->GetThumbnailGenerator(); | 271 ThumbnailGenerator* generator = g_browser_process->GetThumbnailGenerator(); |
| 271 if (generator) | 272 if (generator) |
| 272 generator->StartThumbnailing(); | 273 generator->StartThumbnailing(); |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 if (controller_.pending_entry() && | 1266 if (controller_.pending_entry() && |
| 1266 (controller_.GetLastCommittedEntry() || | 1267 (controller_.GetLastCommittedEntry() || |
| 1267 render_manager_.pending_dom_ui())) | 1268 render_manager_.pending_dom_ui())) |
| 1268 return render_manager_.pending_dom_ui(); | 1269 return render_manager_.pending_dom_ui(); |
| 1269 return render_manager_.dom_ui(); | 1270 return render_manager_.dom_ui(); |
| 1270 } | 1271 } |
| 1271 | 1272 |
| 1272 void TabContents::DidNavigateMainFramePostCommit( | 1273 void TabContents::DidNavigateMainFramePostCommit( |
| 1273 const NavigationController::LoadCommittedDetails& details, | 1274 const NavigationController::LoadCommittedDetails& details, |
| 1274 const ViewHostMsg_FrameNavigate_Params& params) { | 1275 const ViewHostMsg_FrameNavigate_Params& params) { |
| 1276 if (opener_dom_ui_type_ != DOMUIFactory::kNoDOMUI) { |
| 1277 // If this is a window.open navigation, use the same DOMUI as the renderer |
| 1278 // that opened the window, as long as both renderers have the same |
| 1279 // privileges. |
| 1280 if (opener_dom_ui_type_ == DOMUIFactory::GetDOMUIType(GetURL())) { |
| 1281 DOMUI* dom_ui = DOMUIFactory::CreateDOMUIForURL(this, GetURL()); |
| 1282 // dom_ui might be NULL if the URL refers to a non-existent extension. |
| 1283 if (dom_ui) { |
| 1284 render_manager_.SetDOMUIPostCommit(dom_ui); |
| 1285 dom_ui->RenderViewCreated(render_view_host()); |
| 1286 } |
| 1287 } |
| 1288 opener_dom_ui_type_ = DOMUIFactory::kNoDOMUI; |
| 1289 } |
| 1290 |
| 1275 if (details.is_user_initiated_main_frame_load()) { | 1291 if (details.is_user_initiated_main_frame_load()) { |
| 1276 // Clear the status bubble. This is a workaround for a bug where WebKit | 1292 // Clear the status bubble. This is a workaround for a bug where WebKit |
| 1277 // doesn't let us know that the cursor left an element during a | 1293 // doesn't let us know that the cursor left an element during a |
| 1278 // transition (this is also why the mouse cursor remains as a hand after | 1294 // transition (this is also why the mouse cursor remains as a hand after |
| 1279 // clicking on a link); see bugs 1184641 and 980803. We don't want to | 1295 // clicking on a link); see bugs 1184641 and 980803. We don't want to |
| 1280 // clear the bubble when a user navigates to a named anchor in the same | 1296 // clear the bubble when a user navigates to a named anchor in the same |
| 1281 // page. | 1297 // page. |
| 1282 UpdateTargetURL(details.entry->page_id(), GURL()); | 1298 UpdateTargetURL(details.entry->page_id(), GURL()); |
| 1283 | 1299 |
| 1284 // UpdateHelpersForDidNavigate will handle the case where the password_form | 1300 // UpdateHelpersForDidNavigate will handle the case where the password_form |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 | 2121 |
| 2106 void TabContents::DomOperationResponse(const std::string& json_string, | 2122 void TabContents::DomOperationResponse(const std::string& json_string, |
| 2107 int automation_id) { | 2123 int automation_id) { |
| 2108 } | 2124 } |
| 2109 | 2125 |
| 2110 void TabContents::ProcessDOMUIMessage(const std::string& message, | 2126 void TabContents::ProcessDOMUIMessage(const std::string& message, |
| 2111 const std::string& content, | 2127 const std::string& content, |
| 2112 int request_id, | 2128 int request_id, |
| 2113 bool has_callback) { | 2129 bool has_callback) { |
| 2114 if (!render_manager_.dom_ui()) { | 2130 if (!render_manager_.dom_ui()) { |
| 2115 // We shouldn't get a DOM UI message when we haven't enabled the DOM UI. | 2131 // This can happen if someone uses window.open() to open an extension URL |
| 2116 // Because the renderer might be owned and sending random messages, we need | 2132 // from a non-extension context. |
| 2117 // to ignore these inproper ones. | 2133 render_view_host()->BlockExtensionRequest(request_id); |
| 2118 NOTREACHED(); | |
| 2119 return; | 2134 return; |
| 2120 } | 2135 } |
| 2121 render_manager_.dom_ui()->ProcessDOMUIMessage(message, content, request_id, | 2136 render_manager_.dom_ui()->ProcessDOMUIMessage(message, content, request_id, |
| 2122 has_callback); | 2137 has_callback); |
| 2123 } | 2138 } |
| 2124 | 2139 |
| 2125 void TabContents::ProcessExternalHostMessage(const std::string& message, | 2140 void TabContents::ProcessExternalHostMessage(const std::string& message, |
| 2126 const std::string& origin, | 2141 const std::string& origin, |
| 2127 const std::string& target) { | 2142 const std::string& target) { |
| 2128 if (delegate()) | 2143 if (delegate()) |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 | 2485 |
| 2471 default: | 2486 default: |
| 2472 NOTREACHED(); | 2487 NOTREACHED(); |
| 2473 } | 2488 } |
| 2474 } | 2489 } |
| 2475 | 2490 |
| 2476 void TabContents::set_encoding(const std::wstring& encoding) { | 2491 void TabContents::set_encoding(const std::wstring& encoding) { |
| 2477 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2492 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
| 2478 } | 2493 } |
| 2479 | 2494 |
| OLD | NEW |