Chromium Code Reviews| 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, |
|
jam
2011/07/22 16:58:38
nit: browser_context
| |
| 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.browser_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* browser_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, browser_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(browser_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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 const NavigationEntry& entry, | 531 const NavigationEntry& entry, |
| 532 NavigationController::ReloadType reload_type) { | 532 NavigationController::ReloadType reload_type) { |
| 533 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry); | 533 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry); |
| 534 if (!dest_render_view_host) | 534 if (!dest_render_view_host) |
| 535 return false; // Unable to create the desired render view host. | 535 return false; // Unable to create the desired render view host. |
| 536 | 536 |
| 537 // For security, we should never send non-Web-UI URLs to a Web UI renderer. | 537 // For security, we should never send non-Web-UI URLs to a Web UI renderer. |
| 538 // Double check that here. | 538 // Double check that here. |
| 539 int enabled_bindings = dest_render_view_host->enabled_bindings(); | 539 int enabled_bindings = dest_render_view_host->enabled_bindings(); |
| 540 bool is_allowed_in_web_ui_renderer = content::GetContentClient()-> | 540 bool is_allowed_in_web_ui_renderer = content::GetContentClient()-> |
| 541 browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(profile(), | 541 browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(browser_context(), |
| 542 entry.url()); | 542 entry.url()); |
| 543 CHECK(!BindingsPolicy::is_web_ui_enabled(enabled_bindings) || | 543 CHECK(!BindingsPolicy::is_web_ui_enabled(enabled_bindings) || |
| 544 is_allowed_in_web_ui_renderer); | 544 is_allowed_in_web_ui_renderer); |
| 545 | 545 |
| 546 // Tell DevTools agent that it is attached prior to the navigation. | 546 // Tell DevTools agent that it is attached prior to the navigation. |
| 547 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); | 547 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); |
| 548 if (devtools_manager) { // NULL in unit tests. | 548 if (devtools_manager) { // NULL in unit tests. |
| 549 devtools_manager->OnNavigatingToPendingEntry(render_view_host(), | 549 devtools_manager->OnNavigatingToPendingEntry(render_view_host(), |
| 550 dest_render_view_host, | 550 dest_render_view_host, |
| 551 entry.url()); | 551 entry.url()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 | 586 |
| 587 void TabContents::Stop() { | 587 void TabContents::Stop() { |
| 588 render_manager_.Stop(); | 588 render_manager_.Stop(); |
| 589 FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); | 589 FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); |
| 590 } | 590 } |
| 591 | 591 |
| 592 TabContents* TabContents::Clone() { | 592 TabContents* TabContents::Clone() { |
| 593 // We create a new SiteInstance so that the new tab won't share processes | 593 // We create a new SiteInstance so that the new tab won't share processes |
| 594 // with the old one. This can be changed in the future if we need it to share | 594 // with the old one. This can be changed in the future if we need it to share |
| 595 // processes for some reason. | 595 // processes for some reason. |
| 596 TabContents* tc = new TabContents(profile(), | 596 TabContents* tc = new TabContents( |
| 597 SiteInstance::CreateSiteInstance(profile()), | 597 browser_context(), |
| 598 MSG_ROUTING_NONE, this, NULL); | 598 SiteInstance::CreateSiteInstance(browser_context()), |
| 599 MSG_ROUTING_NONE, this, NULL); | |
| 599 tc->controller().CopyStateFrom(controller_); | 600 tc->controller().CopyStateFrom(controller_); |
| 600 return tc; | 601 return tc; |
| 601 } | 602 } |
| 602 | 603 |
| 603 void TabContents::ShowPageInfo(const GURL& url, | 604 void TabContents::ShowPageInfo(const GURL& url, |
| 604 const NavigationEntry::SSLStatus& ssl, | 605 const NavigationEntry::SSLStatus& ssl, |
| 605 bool show_history) { | 606 bool show_history) { |
| 606 if (!delegate_) | 607 if (!delegate_) |
| 607 return; | 608 return; |
| 608 | 609 |
| 609 delegate_->ShowPageInfo(profile(), url, ssl, show_history); | 610 delegate_->ShowPageInfo(browser_context(), url, ssl, show_history); |
| 610 } | 611 } |
| 611 | 612 |
| 612 ConstrainedWindow* TabContents::CreateConstrainedDialog( | 613 ConstrainedWindow* TabContents::CreateConstrainedDialog( |
| 613 ConstrainedWindowDelegate* delegate) { | 614 ConstrainedWindowDelegate* delegate) { |
| 614 ConstrainedWindow* window = | 615 ConstrainedWindow* window = |
| 615 ConstrainedWindow::CreateConstrainedDialog(this, delegate); | 616 ConstrainedWindow::CreateConstrainedDialog(this, delegate); |
| 616 AddConstrainedDialog(window); | 617 AddConstrainedDialog(window); |
| 617 return window; | 618 return window; |
| 618 } | 619 } |
| 619 | 620 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 713 } else { | 714 } else { |
| 714 if (removed_topmost_window) | 715 if (removed_topmost_window) |
| 715 child_windows_[0]->ShowConstrainedWindow(); | 716 child_windows_[0]->ShowConstrainedWindow(); |
| 716 BlockTabContent(true); | 717 BlockTabContent(true); |
| 717 } | 718 } |
| 718 } | 719 } |
| 719 | 720 |
| 720 void TabContents::OnSavePage() { | 721 void TabContents::OnSavePage() { |
| 721 // If we can not save the page, try to download it. | 722 // If we can not save the page, try to download it. |
| 722 if (!SavePackage::IsSavableContents(contents_mime_type())) { | 723 if (!SavePackage::IsSavableContents(contents_mime_type())) { |
| 723 DownloadManager* dlm = profile()->GetDownloadManager(); | 724 DownloadManager* dlm = browser_context()->GetDownloadManager(); |
| 724 const GURL& current_page_url = GetURL(); | 725 const GURL& current_page_url = GetURL(); |
| 725 if (dlm && current_page_url.is_valid()) { | 726 if (dlm && current_page_url.is_valid()) { |
| 726 dlm->DownloadUrl(current_page_url, GURL(), "", this); | 727 dlm->DownloadUrl(current_page_url, GURL(), "", this); |
| 727 download_util::RecordDownloadCount( | 728 download_util::RecordDownloadCount( |
| 728 download_util::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT); | 729 download_util::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT); |
| 729 return; | 730 return; |
| 730 } | 731 } |
| 731 } | 732 } |
| 732 | 733 |
| 733 Stop(); | 734 Stop(); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 745 bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, | 746 bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, |
| 746 SavePackage::SavePackageType save_type) { | 747 SavePackage::SavePackageType save_type) { |
| 747 // Stop the page from navigating. | 748 // Stop the page from navigating. |
| 748 Stop(); | 749 Stop(); |
| 749 | 750 |
| 750 save_package_ = new SavePackage(this, save_type, main_file, dir_path); | 751 save_package_ = new SavePackage(this, save_type, main_file, dir_path); |
| 751 return save_package_->Init(); | 752 return save_package_->Init(); |
| 752 } | 753 } |
| 753 | 754 |
| 754 void TabContents::OnSaveURL(const GURL& url) { | 755 void TabContents::OnSaveURL(const GURL& url) { |
| 755 DownloadManager* dlm = profile()->GetDownloadManager(); | 756 DownloadManager* dlm = browser_context()->GetDownloadManager(); |
| 756 dlm->DownloadUrl(url, GetURL(), "", this); | 757 dlm->DownloadUrl(url, GetURL(), "", this); |
| 757 } | 758 } |
| 758 | 759 |
| 759 bool TabContents::IsActiveEntry(int32 page_id) { | 760 bool TabContents::IsActiveEntry(int32 page_id) { |
| 760 NavigationEntry* active_entry = controller_.GetActiveEntry(); | 761 NavigationEntry* active_entry = controller_.GetActiveEntry(); |
| 761 return (active_entry != NULL && | 762 return (active_entry != NULL && |
| 762 active_entry->site_instance() == GetSiteInstance() && | 763 active_entry->site_instance() == GetSiteInstance() && |
| 763 active_entry->page_id() == page_id); | 764 active_entry->page_id() == page_id); |
| 764 } | 765 } |
| 765 | 766 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 793 } | 794 } |
| 794 | 795 |
| 795 void TabContents::SystemDragEnded() { | 796 void TabContents::SystemDragEnded() { |
| 796 if (render_view_host()) | 797 if (render_view_host()) |
| 797 render_view_host()->DragSourceSystemDragEnded(); | 798 render_view_host()->DragSourceSystemDragEnded(); |
| 798 if (delegate()) | 799 if (delegate()) |
| 799 delegate()->DragEnded(); | 800 delegate()->DragEnded(); |
| 800 } | 801 } |
| 801 | 802 |
| 802 double TabContents::GetZoomLevel() const { | 803 double TabContents::GetZoomLevel() const { |
| 803 HostZoomMap* zoom_map = profile()->GetHostZoomMap(); | 804 HostZoomMap* zoom_map = browser_context()->GetHostZoomMap(); |
| 804 if (!zoom_map) | 805 if (!zoom_map) |
| 805 return 0; | 806 return 0; |
| 806 | 807 |
| 807 double zoom_level; | 808 double zoom_level; |
| 808 if (temporary_zoom_settings_) { | 809 if (temporary_zoom_settings_) { |
| 809 zoom_level = zoom_map->GetTemporaryZoomLevel( | 810 zoom_level = zoom_map->GetTemporaryZoomLevel( |
| 810 GetRenderProcessHost()->id(), render_view_host()->routing_id()); | 811 GetRenderProcessHost()->id(), render_view_host()->routing_id()); |
| 811 } else { | 812 } else { |
| 812 zoom_level = zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(GetURL())); | 813 zoom_level = zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(GetURL())); |
| 813 } | 814 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1115 // - Normal state with no load: committed nav entry + no pending nav entry: | 1116 // - Normal state with no load: committed nav entry + no pending nav entry: |
| 1116 // -> Use committed Web UI. | 1117 // -> Use committed Web UI. |
| 1117 if (controller_.pending_entry() && | 1118 if (controller_.pending_entry() && |
| 1118 (controller_.GetLastCommittedEntry() || | 1119 (controller_.GetLastCommittedEntry() || |
| 1119 render_manager_.pending_web_ui())) | 1120 render_manager_.pending_web_ui())) |
| 1120 return render_manager_.pending_web_ui(); | 1121 return render_manager_.pending_web_ui(); |
| 1121 return render_manager_.web_ui(); | 1122 return render_manager_.web_ui(); |
| 1122 } | 1123 } |
| 1123 | 1124 |
| 1124 WebUI::TypeID TabContents::GetWebUITypeForCurrentState() { | 1125 WebUI::TypeID TabContents::GetWebUITypeForCurrentState() { |
| 1125 return content::WebUIFactory::Get()->GetWebUIType(profile(), GetURL()); | 1126 return content::WebUIFactory::Get()->GetWebUIType(browser_context(), |
| 1127 GetURL()); | |
| 1126 } | 1128 } |
| 1127 | 1129 |
| 1128 void TabContents::DidNavigateMainFramePostCommit( | 1130 void TabContents::DidNavigateMainFramePostCommit( |
| 1129 const content::LoadCommittedDetails& details, | 1131 const content::LoadCommittedDetails& details, |
| 1130 const ViewHostMsg_FrameNavigate_Params& params) { | 1132 const ViewHostMsg_FrameNavigate_Params& params) { |
| 1131 if (opener_web_ui_type_ != WebUI::kNoWebUI) { | 1133 if (opener_web_ui_type_ != WebUI::kNoWebUI) { |
| 1132 // If this is a window.open navigation, use the same WebUI as the renderer | 1134 // If this is a window.open navigation, use the same WebUI as the renderer |
| 1133 // that opened the window, as long as both renderers have the same | 1135 // that opened the window, as long as both renderers have the same |
| 1134 // privileges. | 1136 // privileges. |
| 1135 if (delegate_ && opener_web_ui_type_ == GetWebUITypeForCurrentState()) { | 1137 if (delegate_ && opener_web_ui_type_ == GetWebUITypeForCurrentState()) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1303 | 1305 |
| 1304 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { | 1306 RenderViewHostDelegate::View* TabContents::GetViewDelegate() { |
| 1305 return view_.get(); | 1307 return view_.get(); |
| 1306 } | 1308 } |
| 1307 | 1309 |
| 1308 RenderViewHostDelegate::RendererManagement* | 1310 RenderViewHostDelegate::RendererManagement* |
| 1309 TabContents::GetRendererManagementDelegate() { | 1311 TabContents::GetRendererManagementDelegate() { |
| 1310 return &render_manager_; | 1312 return &render_manager_; |
| 1311 } | 1313 } |
| 1312 | 1314 |
| 1313 RendererPreferences TabContents::GetRendererPrefs(Profile* profile) const { | 1315 RendererPreferences TabContents::GetRendererPrefs( |
| 1316 content::BrowserContext* context) const { | |
| 1314 return renderer_preferences_; | 1317 return renderer_preferences_; |
| 1315 } | 1318 } |
| 1316 | 1319 |
| 1317 TabContents* TabContents::GetAsTabContents() { | 1320 TabContents* TabContents::GetAsTabContents() { |
| 1318 return this; | 1321 return this; |
| 1319 } | 1322 } |
| 1320 | 1323 |
| 1321 ViewType::Type TabContents::GetRenderViewType() const { | 1324 ViewType::Type TabContents::GetRenderViewType() const { |
| 1322 return ViewType::TAB_CONTENTS; | 1325 return ViewType::TAB_CONTENTS; |
| 1323 } | 1326 } |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1678 is_showing_before_unload_dialog_ = true; | 1681 is_showing_before_unload_dialog_ = true; |
| 1679 delegate_->GetJavaScriptDialogCreator()->RunBeforeUnloadDialog( | 1682 delegate_->GetJavaScriptDialogCreator()->RunBeforeUnloadDialog( |
| 1680 this, | 1683 this, |
| 1681 message, | 1684 message, |
| 1682 reply_msg); | 1685 reply_msg); |
| 1683 } | 1686 } |
| 1684 | 1687 |
| 1685 WebPreferences TabContents::GetWebkitPrefs() { | 1688 WebPreferences TabContents::GetWebkitPrefs() { |
| 1686 WebPreferences web_prefs = | 1689 WebPreferences web_prefs = |
| 1687 content::GetContentClient()->browser()->GetWebkitPrefs( | 1690 content::GetContentClient()->browser()->GetWebkitPrefs( |
| 1688 render_view_host()->process()->profile(), false); | 1691 render_view_host()->process()->context(), false); |
| 1689 | 1692 |
| 1690 // Force accelerated compositing and 2d canvas off for chrome:, about: and | 1693 // Force accelerated compositing and 2d canvas off for chrome:, about: and |
| 1691 // chrome-devtools: pages. | 1694 // chrome-devtools: pages. |
| 1692 if (GetURL().SchemeIs(chrome::kChromeDevToolsScheme) || | 1695 if (GetURL().SchemeIs(chrome::kChromeDevToolsScheme) || |
| 1693 GetURL().SchemeIs(chrome::kChromeUIScheme) || | 1696 GetURL().SchemeIs(chrome::kChromeUIScheme) || |
| 1694 GetURL().SchemeIs(chrome::kAboutScheme)) { | 1697 GetURL().SchemeIs(chrome::kAboutScheme)) { |
| 1695 web_prefs.accelerated_compositing_enabled = false; | 1698 web_prefs.accelerated_compositing_enabled = false; |
| 1696 web_prefs.accelerated_2d_canvas_enabled = false; | 1699 web_prefs.accelerated_2d_canvas_enabled = false; |
| 1697 } | 1700 } |
| 1698 | 1701 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1884 } | 1887 } |
| 1885 | 1888 |
| 1886 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 1889 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
| 1887 render_manager_.SwapInRenderViewHost(rvh); | 1890 render_manager_.SwapInRenderViewHost(rvh); |
| 1888 } | 1891 } |
| 1889 | 1892 |
| 1890 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1893 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1891 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1894 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1892 rwh_view->SetSize(view()->GetContainerSize()); | 1895 rwh_view->SetSize(view()->GetContainerSize()); |
| 1893 } | 1896 } |
| OLD | NEW |