| 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" |
| 11 #include "base/metrics/stats_counters.h" | 11 #include "base/metrics/stats_counters.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/download/download_manager.h" | 16 #include "chrome/browser/download/download_manager.h" |
| 17 #include "chrome/browser/download/download_request_limiter.h" | 17 #include "chrome/browser/download/download_request_limiter.h" |
| 18 #include "chrome/browser/download/download_util.h" | 18 #include "chrome/browser/download/download_util.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "content/browser/browser_context.h" |
| 20 #include "content/browser/child_process_security_policy.h" | 20 #include "content/browser/child_process_security_policy.h" |
| 21 #include "content/browser/content_browser_client.h" | 21 #include "content/browser/content_browser_client.h" |
| 22 #include "content/browser/debugger/devtools_manager.h" | 22 #include "content/browser/debugger/devtools_manager.h" |
| 23 #include "content/browser/host_zoom_map.h" | 23 #include "content/browser/host_zoom_map.h" |
| 24 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 24 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
| 25 #include "content/browser/load_from_memory_cache_details.h" | 25 #include "content/browser/load_from_memory_cache_details.h" |
| 26 #include "content/browser/load_notification_details.h" | 26 #include "content/browser/load_notification_details.h" |
| 27 #include "content/browser/renderer_host/render_process_host.h" | 27 #include "content/browser/renderer_host/render_process_host.h" |
| 28 #include "content/browser/renderer_host/render_view_host.h" | 28 #include "content/browser/renderer_host/render_view_host.h" |
| 29 #include "content/browser/renderer_host/render_widget_host_view.h" | 29 #include "content/browser/renderer_host/render_widget_host_view.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) { | 116 BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) { |
| 117 // Note: erase is required to properly paint some widgets borders. This can | 117 // Note: erase is required to properly paint some widgets borders. This can |
| 118 // be seen with textfields. | 118 // be seen with textfields. |
| 119 InvalidateRect(hwnd, NULL, TRUE); | 119 InvalidateRect(hwnd, NULL, TRUE); |
| 120 return TRUE; | 120 return TRUE; |
| 121 } | 121 } |
| 122 #endif | 122 #endif |
| 123 | 123 |
| 124 ViewMsg_Navigate_Type::Value GetNavigationType( | 124 ViewMsg_Navigate_Type::Value GetNavigationType( |
| 125 Profile* profile, const NavigationEntry& entry, | 125 content::BrowserContext* context, const NavigationEntry& entry, |
| 126 NavigationController::ReloadType reload_type) { | 126 NavigationController::ReloadType reload_type) { |
| 127 switch (reload_type) { | 127 switch (reload_type) { |
| 128 case NavigationController::RELOAD: | 128 case NavigationController::RELOAD: |
| 129 return ViewMsg_Navigate_Type::RELOAD; | 129 return ViewMsg_Navigate_Type::RELOAD; |
| 130 case NavigationController::RELOAD_IGNORING_CACHE: | 130 case NavigationController::RELOAD_IGNORING_CACHE: |
| 131 return ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; | 131 return ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; |
| 132 case NavigationController::NO_RELOAD: | 132 case NavigationController::NO_RELOAD: |
| 133 break; // Fall through to rest of function. | 133 break; // Fall through to rest of function. |
| 134 } | 134 } |
| 135 | 135 |
| 136 if (entry.restore_type() == NavigationEntry::RESTORE_LAST_SESSION && | 136 if (entry.restore_type() == NavigationEntry::RESTORE_LAST_SESSION && |
| 137 profile->DidLastSessionExitCleanly()) | 137 context->DidLastSessionExitCleanly()) |
| 138 return ViewMsg_Navigate_Type::RESTORE; | 138 return ViewMsg_Navigate_Type::RESTORE; |
| 139 | 139 |
| 140 return ViewMsg_Navigate_Type::NORMAL; | 140 return ViewMsg_Navigate_Type::NORMAL; |
| 141 } | 141 } |
| 142 | 142 |
| 143 void MakeNavigateParams(const NavigationEntry& entry, | 143 void MakeNavigateParams(const NavigationEntry& entry, |
| 144 const NavigationController& controller, | 144 const NavigationController& controller, |
| 145 NavigationController::ReloadType reload_type, | 145 NavigationController::ReloadType reload_type, |
| 146 ViewMsg_Navigate_Params* params) { | 146 ViewMsg_Navigate_Params* params) { |
| 147 params->page_id = entry.page_id(); | 147 params->page_id = entry.page_id(); |
| 148 params->pending_history_list_offset = controller.GetIndexOfEntry(&entry); | 148 params->pending_history_list_offset = controller.GetIndexOfEntry(&entry); |
| 149 params->current_history_list_offset = controller.last_committed_entry_index(); | 149 params->current_history_list_offset = controller.last_committed_entry_index(); |
| 150 params->current_history_list_length = controller.entry_count(); | 150 params->current_history_list_length = controller.entry_count(); |
| 151 params->url = entry.url(); | 151 params->url = entry.url(); |
| 152 params->referrer = entry.referrer(); | 152 params->referrer = entry.referrer(); |
| 153 params->transition = entry.transition_type(); | 153 params->transition = entry.transition_type(); |
| 154 params->state = entry.content_state(); | 154 params->state = entry.content_state(); |
| 155 params->navigation_type = | 155 params->navigation_type = |
| 156 GetNavigationType(controller.profile(), entry, reload_type); | 156 GetNavigationType(controller.context(), entry, reload_type); |
| 157 params->request_time = base::Time::Now(); | 157 params->request_time = base::Time::Now(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace | 160 } // namespace |
| 161 | 161 |
| 162 | 162 |
| 163 // TabContents ---------------------------------------------------------------- | 163 // TabContents ---------------------------------------------------------------- |
| 164 | 164 |
| 165 TabContents::TabContents(Profile* profile, | 165 TabContents::TabContents(content::BrowserContext* context, |
| 166 SiteInstance* site_instance, | 166 SiteInstance* site_instance, |
| 167 int routing_id, | 167 int routing_id, |
| 168 const TabContents* base_tab_contents, | 168 const TabContents* base_tab_contents, |
| 169 SessionStorageNamespace* session_storage_namespace) | 169 SessionStorageNamespace* session_storage_namespace) |
| 170 : delegate_(NULL), | 170 : delegate_(NULL), |
| 171 ALLOW_THIS_IN_INITIALIZER_LIST(controller_( | 171 ALLOW_THIS_IN_INITIALIZER_LIST(controller_( |
| 172 this, profile, session_storage_namespace)), | 172 this, context, session_storage_namespace)), |
| 173 ALLOW_THIS_IN_INITIALIZER_LIST(view_( | 173 ALLOW_THIS_IN_INITIALIZER_LIST(view_( |
| 174 TabContentsView::Create(this))), | 174 TabContentsView::Create(this))), |
| 175 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), | 175 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), |
| 176 is_loading_(false), | 176 is_loading_(false), |
| 177 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 177 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 178 crashed_error_code_(0), | 178 crashed_error_code_(0), |
| 179 waiting_for_response_(false), | 179 waiting_for_response_(false), |
| 180 max_page_id_(-1), | 180 max_page_id_(-1), |
| 181 load_state_(net::LOAD_STATE_IDLE), | 181 load_state_(net::LOAD_STATE_IDLE), |
| 182 upload_size_(0), | 182 upload_size_(0), |
| 183 upload_position_(0), | 183 upload_position_(0), |
| 184 displayed_insecure_content_(false), | 184 displayed_insecure_content_(false), |
| 185 capturing_contents_(false), | 185 capturing_contents_(false), |
| 186 is_being_destroyed_(false), | 186 is_being_destroyed_(false), |
| 187 notify_disconnection_(false), | 187 notify_disconnection_(false), |
| 188 #if defined(OS_WIN) | 188 #if defined(OS_WIN) |
| 189 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), | 189 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), |
| 190 #endif | 190 #endif |
| 191 is_showing_before_unload_dialog_(false), | 191 is_showing_before_unload_dialog_(false), |
| 192 opener_web_ui_type_(WebUI::kNoWebUI), | 192 opener_web_ui_type_(WebUI::kNoWebUI), |
| 193 closed_by_user_gesture_(false), | 193 closed_by_user_gesture_(false), |
| 194 minimum_zoom_percent_( | 194 minimum_zoom_percent_( |
| 195 static_cast<int>(WebKit::WebView::minTextSizeMultiplier * 100)), | 195 static_cast<int>(WebKit::WebView::minTextSizeMultiplier * 100)), |
| 196 maximum_zoom_percent_( | 196 maximum_zoom_percent_( |
| 197 static_cast<int>(WebKit::WebView::maxTextSizeMultiplier * 100)), | 197 static_cast<int>(WebKit::WebView::maxTextSizeMultiplier * 100)), |
| 198 temporary_zoom_settings_(false), | 198 temporary_zoom_settings_(false), |
| 199 content_restrictions_(0) { | 199 content_restrictions_(0) { |
| 200 | 200 |
| 201 render_manager_.Init(profile, site_instance, routing_id); | 201 render_manager_.Init(context, site_instance, routing_id); |
| 202 | 202 |
| 203 // We have the initial size of the view be based on the size of the passed in | 203 // We have the initial size of the view be based on the size of the passed in |
| 204 // tab contents (normally a tab from the same window). | 204 // tab contents (normally a tab from the same window). |
| 205 view_->CreateView(base_tab_contents ? | 205 view_->CreateView(base_tab_contents ? |
| 206 base_tab_contents->view()->GetContainerSize() : gfx::Size()); | 206 base_tab_contents->view()->GetContainerSize() : gfx::Size()); |
| 207 } | 207 } |
| 208 | 208 |
| 209 TabContents::~TabContents() { | 209 TabContents::~TabContents() { |
| 210 is_being_destroyed_ = true; | 210 is_being_destroyed_ = true; |
| 211 | 211 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 const NavigationEntry& entry, | 523 const NavigationEntry& entry, |
| 524 NavigationController::ReloadType reload_type) { | 524 NavigationController::ReloadType reload_type) { |
| 525 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry); | 525 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry); |
| 526 if (!dest_render_view_host) | 526 if (!dest_render_view_host) |
| 527 return false; // Unable to create the desired render view host. | 527 return false; // Unable to create the desired render view host. |
| 528 | 528 |
| 529 // For security, we should never send non-Web-UI URLs to a Web UI renderer. | 529 // For security, we should never send non-Web-UI URLs to a Web UI renderer. |
| 530 // Double check that here. | 530 // Double check that here. |
| 531 int enabled_bindings = dest_render_view_host->enabled_bindings(); | 531 int enabled_bindings = dest_render_view_host->enabled_bindings(); |
| 532 bool is_allowed_in_web_ui_renderer = content::GetContentClient()-> | 532 bool is_allowed_in_web_ui_renderer = content::GetContentClient()-> |
| 533 browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(profile(), | 533 browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(context(), |
| 534 entry.url()); | 534 entry.url()); |
| 535 CHECK(!BindingsPolicy::is_web_ui_enabled(enabled_bindings) || | 535 CHECK(!BindingsPolicy::is_web_ui_enabled(enabled_bindings) || |
| 536 is_allowed_in_web_ui_renderer); | 536 is_allowed_in_web_ui_renderer); |
| 537 | 537 |
| 538 // Tell DevTools agent that it is attached prior to the navigation. | 538 // Tell DevTools agent that it is attached prior to the navigation. |
| 539 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); | 539 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); |
| 540 if (devtools_manager) { // NULL in unit tests. | 540 if (devtools_manager) { // NULL in unit tests. |
| 541 devtools_manager->OnNavigatingToPendingEntry(render_view_host(), | 541 devtools_manager->OnNavigatingToPendingEntry(render_view_host(), |
| 542 dest_render_view_host, | 542 dest_render_view_host, |
| 543 entry.url()); | 543 entry.url()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 | 578 |
| 579 void TabContents::Stop() { | 579 void TabContents::Stop() { |
| 580 render_manager_.Stop(); | 580 render_manager_.Stop(); |
| 581 FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); | 581 FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); |
| 582 } | 582 } |
| 583 | 583 |
| 584 TabContents* TabContents::Clone() { | 584 TabContents* TabContents::Clone() { |
| 585 // We create a new SiteInstance so that the new tab won't share processes | 585 // We create a new SiteInstance so that the new tab won't share processes |
| 586 // with the old one. This can be changed in the future if we need it to share | 586 // with the old one. This can be changed in the future if we need it to share |
| 587 // processes for some reason. | 587 // processes for some reason. |
| 588 TabContents* tc = new TabContents(profile(), | 588 TabContents* tc = new TabContents(context(), |
| 589 SiteInstance::CreateSiteInstance(profile()), | 589 SiteInstance::CreateSiteInstance(context()), |
| 590 MSG_ROUTING_NONE, this, NULL); | 590 MSG_ROUTING_NONE, this, NULL); |
| 591 tc->controller().CopyStateFrom(controller_); | 591 tc->controller().CopyStateFrom(controller_); |
| 592 return tc; | 592 return tc; |
| 593 } | 593 } |
| 594 | 594 |
| 595 void TabContents::ShowPageInfo(const GURL& url, | 595 void TabContents::ShowPageInfo(const GURL& url, |
| 596 const NavigationEntry::SSLStatus& ssl, | 596 const NavigationEntry::SSLStatus& ssl, |
| 597 bool show_history) { | 597 bool show_history) { |
| 598 if (!delegate_) | 598 if (!delegate_) |
| 599 return; | 599 return; |
| 600 | 600 |
| 601 delegate_->ShowPageInfo(profile(), url, ssl, show_history); | 601 delegate_->ShowPageInfo(context(), url, ssl, show_history); |
| 602 } | 602 } |
| 603 | 603 |
| 604 ConstrainedWindow* TabContents::CreateConstrainedDialog( | 604 ConstrainedWindow* TabContents::CreateConstrainedDialog( |
| 605 ConstrainedWindowDelegate* delegate) { | 605 ConstrainedWindowDelegate* delegate) { |
| 606 ConstrainedWindow* window = | 606 ConstrainedWindow* window = |
| 607 ConstrainedWindow::CreateConstrainedDialog(this, delegate); | 607 ConstrainedWindow::CreateConstrainedDialog(this, delegate); |
| 608 AddConstrainedDialog(window); | 608 AddConstrainedDialog(window); |
| 609 return window; | 609 return window; |
| 610 } | 610 } |
| 611 | 611 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 } else { | 705 } else { |
| 706 if (removed_topmost_window) | 706 if (removed_topmost_window) |
| 707 child_windows_[0]->ShowConstrainedWindow(); | 707 child_windows_[0]->ShowConstrainedWindow(); |
| 708 BlockTabContent(true); | 708 BlockTabContent(true); |
| 709 } | 709 } |
| 710 } | 710 } |
| 711 | 711 |
| 712 void TabContents::OnSavePage() { | 712 void TabContents::OnSavePage() { |
| 713 // If we can not save the page, try to download it. | 713 // If we can not save the page, try to download it. |
| 714 if (!SavePackage::IsSavableContents(contents_mime_type())) { | 714 if (!SavePackage::IsSavableContents(contents_mime_type())) { |
| 715 DownloadManager* dlm = profile()->GetDownloadManager(); | 715 DownloadManager* dlm = context()->GetDownloadManager(); |
| 716 const GURL& current_page_url = GetURL(); | 716 const GURL& current_page_url = GetURL(); |
| 717 if (dlm && current_page_url.is_valid()) { | 717 if (dlm && current_page_url.is_valid()) { |
| 718 dlm->DownloadUrl(current_page_url, GURL(), "", this); | 718 dlm->DownloadUrl(current_page_url, GURL(), "", this); |
| 719 download_util::RecordDownloadCount( | 719 download_util::RecordDownloadCount( |
| 720 download_util::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT); | 720 download_util::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT); |
| 721 return; | 721 return; |
| 722 } | 722 } |
| 723 } | 723 } |
| 724 | 724 |
| 725 Stop(); | 725 Stop(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 737 bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, | 737 bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, |
| 738 SavePackage::SavePackageType save_type) { | 738 SavePackage::SavePackageType save_type) { |
| 739 // Stop the page from navigating. | 739 // Stop the page from navigating. |
| 740 Stop(); | 740 Stop(); |
| 741 | 741 |
| 742 save_package_ = new SavePackage(this, save_type, main_file, dir_path); | 742 save_package_ = new SavePackage(this, save_type, main_file, dir_path); |
| 743 return save_package_->Init(); | 743 return save_package_->Init(); |
| 744 } | 744 } |
| 745 | 745 |
| 746 void TabContents::OnSaveURL(const GURL& url) { | 746 void TabContents::OnSaveURL(const GURL& url) { |
| 747 DownloadManager* dlm = profile()->GetDownloadManager(); | 747 DownloadManager* dlm = context()->GetDownloadManager(); |
| 748 dlm->DownloadUrl(url, GetURL(), "", this); | 748 dlm->DownloadUrl(url, GetURL(), "", this); |
| 749 } | 749 } |
| 750 | 750 |
| 751 bool TabContents::IsActiveEntry(int32 page_id) { | 751 bool TabContents::IsActiveEntry(int32 page_id) { |
| 752 NavigationEntry* active_entry = controller_.GetActiveEntry(); | 752 NavigationEntry* active_entry = controller_.GetActiveEntry(); |
| 753 return (active_entry != NULL && | 753 return (active_entry != NULL && |
| 754 active_entry->site_instance() == GetSiteInstance() && | 754 active_entry->site_instance() == GetSiteInstance() && |
| 755 active_entry->page_id() == page_id); | 755 active_entry->page_id() == page_id); |
| 756 } | 756 } |
| 757 | 757 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 785 } | 785 } |
| 786 | 786 |
| 787 void TabContents::SystemDragEnded() { | 787 void TabContents::SystemDragEnded() { |
| 788 if (render_view_host()) | 788 if (render_view_host()) |
| 789 render_view_host()->DragSourceSystemDragEnded(); | 789 render_view_host()->DragSourceSystemDragEnded(); |
| 790 if (delegate()) | 790 if (delegate()) |
| 791 delegate()->DragEnded(); | 791 delegate()->DragEnded(); |
| 792 } | 792 } |
| 793 | 793 |
| 794 double TabContents::GetZoomLevel() const { | 794 double TabContents::GetZoomLevel() const { |
| 795 HostZoomMap* zoom_map = profile()->GetHostZoomMap(); | 795 HostZoomMap* zoom_map = context()->GetHostZoomMap(); |
| 796 if (!zoom_map) | 796 if (!zoom_map) |
| 797 return 0; | 797 return 0; |
| 798 | 798 |
| 799 double zoom_level; | 799 double zoom_level; |
| 800 if (temporary_zoom_settings_) { | 800 if (temporary_zoom_settings_) { |
| 801 zoom_level = zoom_map->GetTemporaryZoomLevel( | 801 zoom_level = zoom_map->GetTemporaryZoomLevel( |
| 802 GetRenderProcessHost()->id(), render_view_host()->routing_id()); | 802 GetRenderProcessHost()->id(), render_view_host()->routing_id()); |
| 803 } else { | 803 } else { |
| 804 zoom_level = zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(GetURL())); | 804 zoom_level = zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(GetURL())); |
| 805 } | 805 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 // - Normal state with no load: committed nav entry + no pending nav entry: | 1107 // - Normal state with no load: committed nav entry + no pending nav entry: |
| 1108 // -> Use committed Web UI. | 1108 // -> Use committed Web UI. |
| 1109 if (controller_.pending_entry() && | 1109 if (controller_.pending_entry() && |
| 1110 (controller_.GetLastCommittedEntry() || | 1110 (controller_.GetLastCommittedEntry() || |
| 1111 render_manager_.pending_web_ui())) | 1111 render_manager_.pending_web_ui())) |
| 1112 return render_manager_.pending_web_ui(); | 1112 return render_manager_.pending_web_ui(); |
| 1113 return render_manager_.web_ui(); | 1113 return render_manager_.web_ui(); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 WebUI::TypeID TabContents::GetWebUITypeForCurrentState() { | 1116 WebUI::TypeID TabContents::GetWebUITypeForCurrentState() { |
| 1117 return content::WebUIFactory::Get()->GetWebUIType(profile(), GetURL()); | 1117 return content::WebUIFactory::Get()->GetWebUIType(context(), GetURL()); |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 void TabContents::DidNavigateMainFramePostCommit( | 1120 void TabContents::DidNavigateMainFramePostCommit( |
| 1121 const content::LoadCommittedDetails& details, | 1121 const content::LoadCommittedDetails& details, |
| 1122 const ViewHostMsg_FrameNavigate_Params& params) { | 1122 const ViewHostMsg_FrameNavigate_Params& params) { |
| 1123 if (opener_web_ui_type_ != WebUI::kNoWebUI) { | 1123 if (opener_web_ui_type_ != WebUI::kNoWebUI) { |
| 1124 // If this is a window.open navigation, use the same WebUI as the renderer | 1124 // If this is a window.open navigation, use the same WebUI as the renderer |
| 1125 // that opened the window, as long as both renderers have the same | 1125 // that opened the window, as long as both renderers have the same |
| 1126 // privileges. | 1126 // privileges. |
| 1127 if (delegate_ && opener_web_ui_type_ == GetWebUITypeForCurrentState()) { | 1127 if (delegate_ && opener_web_ui_type_ == GetWebUITypeForCurrentState()) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 | 1295 |
| 1296 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { | 1296 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { |
| 1297 return view_.get(); | 1297 return view_.get(); |
| 1298 } | 1298 } |
| 1299 | 1299 |
| 1300 RenderViewHostDelegate::RendererManagement* | 1300 RenderViewHostDelegate::RendererManagement* |
| 1301 TabContents::GetRendererManagementDelegate() { | 1301 TabContents::GetRendererManagementDelegate() { |
| 1302 return &render_manager_; | 1302 return &render_manager_; |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 RendererPreferences TabContents::GetRendererPrefs(Profile* profile) const { | 1305 RendererPreferences TabContents::GetRendererPrefs( |
| 1306 content::BrowserContext* context) const { |
| 1306 return renderer_preferences_; | 1307 return renderer_preferences_; |
| 1307 } | 1308 } |
| 1308 | 1309 |
| 1309 TabContents* TabContents::GetAsTabContents() { | 1310 TabContents* TabContents::GetAsTabContents() { |
| 1310 return this; | 1311 return this; |
| 1311 } | 1312 } |
| 1312 | 1313 |
| 1313 ViewType::Type TabContents::GetRenderViewType() const { | 1314 ViewType::Type TabContents::GetRenderViewType() const { |
| 1314 return ViewType::TAB_CONTENTS; | 1315 return ViewType::TAB_CONTENTS; |
| 1315 } | 1316 } |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 is_showing_before_unload_dialog_ = true; | 1671 is_showing_before_unload_dialog_ = true; |
| 1671 delegate_->GetJavaScriptDialogCreator()->RunBeforeUnloadDialog( | 1672 delegate_->GetJavaScriptDialogCreator()->RunBeforeUnloadDialog( |
| 1672 this, | 1673 this, |
| 1673 message, | 1674 message, |
| 1674 reply_msg); | 1675 reply_msg); |
| 1675 } | 1676 } |
| 1676 | 1677 |
| 1677 WebPreferences TabContents::GetWebkitPrefs() { | 1678 WebPreferences TabContents::GetWebkitPrefs() { |
| 1678 WebPreferences web_prefs = | 1679 WebPreferences web_prefs = |
| 1679 content::GetContentClient()->browser()->GetWebkitPrefs( | 1680 content::GetContentClient()->browser()->GetWebkitPrefs( |
| 1680 render_view_host()->process()->profile(), false); | 1681 render_view_host()->process()->context(), false); |
| 1681 | 1682 |
| 1682 // Force accelerated compositing and 2d canvas off for chrome:, about: and | 1683 // Force accelerated compositing and 2d canvas off for chrome:, about: and |
| 1683 // chrome-devtools: pages. | 1684 // chrome-devtools: pages. |
| 1684 if (GetURL().SchemeIs(chrome::kChromeDevToolsScheme) || | 1685 if (GetURL().SchemeIs(chrome::kChromeDevToolsScheme) || |
| 1685 GetURL().SchemeIs(chrome::kChromeUIScheme) || | 1686 GetURL().SchemeIs(chrome::kChromeUIScheme) || |
| 1686 GetURL().SchemeIs(chrome::kAboutScheme)) { | 1687 GetURL().SchemeIs(chrome::kAboutScheme)) { |
| 1687 web_prefs.accelerated_compositing_enabled = false; | 1688 web_prefs.accelerated_compositing_enabled = false; |
| 1688 web_prefs.accelerated_2d_canvas_enabled = false; | 1689 web_prefs.accelerated_2d_canvas_enabled = false; |
| 1689 } | 1690 } |
| 1690 | 1691 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1876 } | 1877 } |
| 1877 | 1878 |
| 1878 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 1879 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
| 1879 render_manager_.SwapInRenderViewHost(rvh); | 1880 render_manager_.SwapInRenderViewHost(rvh); |
| 1880 } | 1881 } |
| 1881 | 1882 |
| 1882 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1883 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1883 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1884 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1884 rwh_view->SetSize(view()->GetContainerSize()); | 1885 rwh_view->SetSize(view()->GetContainerSize()); |
| 1885 } | 1886 } |
| OLD | NEW |