Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(947)

Side by Side Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 3655007: Merge 58701 - Relanding this:... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/517/src/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #if defined(OS_CHROMEOS) 7 #if defined(OS_CHROMEOS)
8 // For GdkScreen 8 // For GdkScreen
9 #include <gdk/gdk.h> 9 #include <gdk/gdk.h>
10 #endif // defined(OS_CHROMEOS) 10 #endif // defined(OS_CHROMEOS)
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 break; // Fall through to rest of function. 220 break; // Fall through to rest of function.
221 } 221 }
222 222
223 if (entry.restore_type() == NavigationEntry::RESTORE_LAST_SESSION && 223 if (entry.restore_type() == NavigationEntry::RESTORE_LAST_SESSION &&
224 profile->DidLastSessionExitCleanly()) 224 profile->DidLastSessionExitCleanly())
225 return ViewMsg_Navigate_Params::RESTORE; 225 return ViewMsg_Navigate_Params::RESTORE;
226 226
227 return ViewMsg_Navigate_Params::NORMAL; 227 return ViewMsg_Navigate_Params::NORMAL;
228 } 228 }
229 229
230 void MakeNavigateParams(const NavigationController& controller, 230 void MakeNavigateParams(const NavigationEntry& entry,
231 const NavigationController& controller,
231 NavigationController::ReloadType reload_type, 232 NavigationController::ReloadType reload_type,
232 ViewMsg_Navigate_Params* params) { 233 ViewMsg_Navigate_Params* params) {
233 const NavigationEntry& entry = *controller.pending_entry();
234 params->page_id = entry.page_id(); 234 params->page_id = entry.page_id();
235 params->pending_history_list_offset = controller.pending_entry_index(); 235 params->pending_history_list_offset = controller.GetIndexOfEntry(&entry);
236 params->current_history_list_offset = controller.last_committed_entry_index(); 236 params->current_history_list_offset = controller.last_committed_entry_index();
237 params->current_history_list_length = controller.entry_count(); 237 params->current_history_list_length = controller.entry_count();
238 params->url = entry.url(); 238 params->url = entry.url();
239 params->referrer = entry.referrer(); 239 params->referrer = entry.referrer();
240 params->transition = entry.transition_type(); 240 params->transition = entry.transition_type();
241 params->state = entry.content_state(); 241 params->state = entry.content_state();
242 params->navigation_type = 242 params->navigation_type =
243 GetNavigationType(controller.profile(), entry, reload_type); 243 GetNavigationType(controller.profile(), entry, reload_type);
244 params->request_time = base::Time::Now(); 244 params->request_time = base::Time::Now();
245 } 245 }
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 842
843 void TabContents::OpenURL(const GURL& url, const GURL& referrer, 843 void TabContents::OpenURL(const GURL& url, const GURL& referrer,
844 WindowOpenDisposition disposition, 844 WindowOpenDisposition disposition,
845 PageTransition::Type transition) { 845 PageTransition::Type transition) {
846 if (delegate_) 846 if (delegate_)
847 delegate_->OpenURLFromTab(this, url, referrer, disposition, transition); 847 delegate_->OpenURLFromTab(this, url, referrer, disposition, transition);
848 } 848 }
849 849
850 bool TabContents::NavigateToPendingEntry( 850 bool TabContents::NavigateToPendingEntry(
851 NavigationController::ReloadType reload_type) { 851 NavigationController::ReloadType reload_type) {
852 const NavigationEntry& entry = *controller_.pending_entry(); 852 return NavigateToEntry(*controller_.pending_entry(), reload_type);
853 }
853 854
855 bool TabContents::NavigateToEntry(
856 const NavigationEntry& entry,
857 NavigationController::ReloadType reload_type) {
854 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry); 858 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry);
855 if (!dest_render_view_host) 859 if (!dest_render_view_host)
856 return false; // Unable to create the desired render view host. 860 return false; // Unable to create the desired render view host.
857 861
858 if (delegate_ && delegate_->ShouldEnablePreferredSizeNotifications()) { 862 if (delegate_ && delegate_->ShouldEnablePreferredSizeNotifications()) {
859 dest_render_view_host->EnablePreferredSizeChangedMode( 863 dest_render_view_host->EnablePreferredSizeChangedMode(
860 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); 864 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow);
861 } 865 }
862 866
863 // For security, we should never send non-DOM-UI URLs (other than about:blank) 867 // For security, we should never send non-DOM-UI URLs (other than about:blank)
(...skipping 11 matching lines...) Expand all
875 devtools_manager->OnNavigatingToPendingEntry(render_view_host(), 879 devtools_manager->OnNavigatingToPendingEntry(render_view_host(),
876 dest_render_view_host, 880 dest_render_view_host,
877 entry.url()); 881 entry.url());
878 } 882 }
879 883
880 // Used for page load time metrics. 884 // Used for page load time metrics.
881 current_load_start_ = base::TimeTicks::Now(); 885 current_load_start_ = base::TimeTicks::Now();
882 886
883 // Navigate in the desired RenderViewHost. 887 // Navigate in the desired RenderViewHost.
884 ViewMsg_Navigate_Params navigate_params; 888 ViewMsg_Navigate_Params navigate_params;
885 MakeNavigateParams(controller_, reload_type, &navigate_params); 889 MakeNavigateParams(entry, controller_, reload_type, &navigate_params);
886 dest_render_view_host->Navigate(navigate_params); 890 dest_render_view_host->Navigate(navigate_params);
887 891
888 if (entry.page_id() == -1) { 892 if (entry.page_id() == -1) {
889 // HACK!! This code suppresses javascript: URLs from being added to 893 // HACK!! This code suppresses javascript: URLs from being added to
890 // session history, which is what we want to do for javascript: URLs that 894 // session history, which is what we want to do for javascript: URLs that
891 // do not generate content. What we really need is a message from the 895 // do not generate content. What we really need is a message from the
892 // renderer telling us that a new page was not created. The same message 896 // renderer telling us that a new page was not created. The same message
893 // could be used for mailto: URLs and the like. 897 // could be used for mailto: URLs and the like.
894 if (entry.url().SchemeIs(chrome::kJavaScriptScheme)) 898 if (entry.url().SchemeIs(chrome::kJavaScriptScheme))
895 return false; 899 return false;
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 last_search_result_ = FindNotificationDetails(request_id, number_of_matches, 1991 last_search_result_ = FindNotificationDetails(request_id, number_of_matches,
1988 selection, active_match_ordinal, 1992 selection, active_match_ordinal,
1989 final_update); 1993 final_update);
1990 NotificationService::current()->Notify( 1994 NotificationService::current()->Notify(
1991 NotificationType::FIND_RESULT_AVAILABLE, 1995 NotificationType::FIND_RESULT_AVAILABLE,
1992 Source<TabContents>(this), 1996 Source<TabContents>(this),
1993 Details<FindNotificationDetails>(&last_search_result_)); 1997 Details<FindNotificationDetails>(&last_search_result_));
1994 } 1998 }
1995 1999
1996 void TabContents::GoToEntryAtOffset(int offset) { 2000 void TabContents::GoToEntryAtOffset(int offset) {
1997 if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) 2001 if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) {
1998 controller_.GoToOffset(offset); 2002 NavigationEntry* entry = controller_.GetEntryAtOffset(offset);
2003 if (!entry)
2004 return;
2005 // Note that we don't call NavigationController::GotToOffset() as we don't
2006 // want to create a pending navigation entry (it might end up lingering
2007 // http://crbug.com/51680).
2008 NavigateToEntry(*entry, NavigationController::NO_RELOAD);
2009 }
1999 } 2010 }
2000 2011
2001 void TabContents::OnMissingPluginStatus(int status) { 2012 void TabContents::OnMissingPluginStatus(int status) {
2002 #if defined(OS_WIN) 2013 #if defined(OS_WIN)
2003 // TODO(PORT): pull in when plug-ins work 2014 // TODO(PORT): pull in when plug-ins work
2004 GetPluginInstaller()->OnMissingPluginStatus(status); 2015 GetPluginInstaller()->OnMissingPluginStatus(status);
2005 #endif 2016 #endif
2006 } 2017 }
2007 2018
2008 void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { 2019 void TabContents::OnCrashedPlugin(const FilePath& plugin_path) {
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
3228 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); 3239 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save));
3229 } 3240 }
3230 3241
3231 Profile* TabContents::GetProfileForPasswordManager() { 3242 Profile* TabContents::GetProfileForPasswordManager() {
3232 return profile(); 3243 return profile();
3233 } 3244 }
3234 3245
3235 bool TabContents::DidLastPageLoadEncounterSSLErrors() { 3246 bool TabContents::DidLastPageLoadEncounterSSLErrors() {
3236 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); 3247 return controller().ssl_manager()->ProcessedSSLErrorFromRequest();
3237 } 3248 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/browser/tab_contents/test_tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698