| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 } | 566 } |
| 567 | 567 |
| 568 bool TabContents::NavigateToPendingEntry( | 568 bool TabContents::NavigateToPendingEntry( |
| 569 NavigationController::ReloadType reload_type) { | 569 NavigationController::ReloadType reload_type) { |
| 570 return NavigateToEntry(*controller_.pending_entry(), reload_type); | 570 return NavigateToEntry(*controller_.pending_entry(), reload_type); |
| 571 } | 571 } |
| 572 | 572 |
| 573 bool TabContents::NavigateToEntry( | 573 bool TabContents::NavigateToEntry( |
| 574 const NavigationEntry& entry, | 574 const NavigationEntry& entry, |
| 575 NavigationController::ReloadType reload_type) { | 575 NavigationController::ReloadType reload_type) { |
| 576 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry); | |
| 577 if (!dest_render_view_host) | |
| 578 return false; // Unable to create the desired render view host. | |
| 579 | |
| 580 // The renderer will reject IPC messages with URLs longer than | 576 // The renderer will reject IPC messages with URLs longer than |
| 581 // this limit, so don't attempt to navigate with a longer URL. | 577 // this limit, so don't attempt to navigate with a longer URL. |
| 582 if (entry.url().spec().size() > content::kMaxURLChars) | 578 if (entry.url().spec().size() > content::kMaxURLChars) |
| 583 return false; | 579 return false; |
| 584 | 580 |
| 581 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry); |
| 582 if (!dest_render_view_host) |
| 583 return false; // Unable to create the desired render view host. |
| 584 |
| 585 // For security, we should never send non-Web-UI URLs to a Web UI renderer. | 585 // For security, we should never send non-Web-UI URLs to a Web UI renderer. |
| 586 // Double check that here. | 586 // Double check that here. |
| 587 int enabled_bindings = dest_render_view_host->enabled_bindings(); | 587 int enabled_bindings = dest_render_view_host->enabled_bindings(); |
| 588 bool is_allowed_in_web_ui_renderer = content::GetContentClient()-> | 588 bool is_allowed_in_web_ui_renderer = content::GetContentClient()-> |
| 589 browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(browser_context(), | 589 browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(browser_context(), |
| 590 entry.url()); | 590 entry.url()); |
| 591 CHECK(!BindingsPolicy::is_web_ui_enabled(enabled_bindings) || | 591 CHECK(!BindingsPolicy::is_web_ui_enabled(enabled_bindings) || |
| 592 is_allowed_in_web_ui_renderer); | 592 is_allowed_in_web_ui_renderer); |
| 593 | 593 |
| 594 // Tell DevTools agent that it is attached prior to the navigation. | 594 // Tell DevTools agent that it is attached prior to the navigation. |
| (...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1958 | 1958 |
| 1959 void TabContents::set_encoding(const std::string& encoding) { | 1959 void TabContents::set_encoding(const std::string& encoding) { |
| 1960 encoding_ = content::GetContentClient()->browser()-> | 1960 encoding_ = content::GetContentClient()->browser()-> |
| 1961 GetCanonicalEncodingNameByAliasName(encoding); | 1961 GetCanonicalEncodingNameByAliasName(encoding); |
| 1962 } | 1962 } |
| 1963 | 1963 |
| 1964 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1964 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1965 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1965 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1966 rwh_view->SetSize(view()->GetContainerSize()); | 1966 rwh_view->SetSize(view()->GetContainerSize()); |
| 1967 } | 1967 } |
| OLD | NEW |