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

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

Issue 8253002: Move PageTransition into content namespace. While I'm touching all these files, I've also updated... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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) 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 "chrome/browser/external_tab_container_win.h" 5 #include "chrome/browser/external_tab_container_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 27 matching lines...) Expand all
38 #include "chrome/common/render_messages.h" 38 #include "chrome/common/render_messages.h"
39 #include "chrome/common/url_constants.h" 39 #include "chrome/common/url_constants.h"
40 #include "content/browser/load_notification_details.h" 40 #include "content/browser/load_notification_details.h"
41 #include "content/browser/renderer_host/render_process_host.h" 41 #include "content/browser/renderer_host/render_process_host.h"
42 #include "content/browser/renderer_host/render_view_host.h" 42 #include "content/browser/renderer_host/render_view_host.h"
43 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 43 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
44 #include "content/browser/tab_contents/navigation_details.h" 44 #include "content/browser/tab_contents/navigation_details.h"
45 #include "content/browser/tab_contents/provisional_load_details.h" 45 #include "content/browser/tab_contents/provisional_load_details.h"
46 #include "content/common/native_web_keyboard_event.h" 46 #include "content/common/native_web_keyboard_event.h"
47 #include "content/common/notification_service.h" 47 #include "content/common/notification_service.h"
48 #include "content/common/page_transition_types.h"
49 #include "content/common/page_zoom.h" 48 #include "content/common/page_zoom.h"
50 #include "content/common/view_messages.h" 49 #include "content/common/view_messages.h"
51 #include "content/public/common/bindings_policy.h" 50 #include "content/public/common/bindings_policy.h"
51 #include "content/public/common/page_transition_types.h"
52 #include "grit/generated_resources.h" 52 #include "grit/generated_resources.h"
53 #include "grit/locale_settings.h" 53 #include "grit/locale_settings.h"
54 #include "ui/base/l10n/l10n_util.h" 54 #include "ui/base/l10n/l10n_util.h"
55 #include "ui/base/resource/resource_bundle.h" 55 #include "ui/base/resource/resource_bundle.h"
56 #include "ui/base/view_prop.h" 56 #include "ui/base/view_prop.h"
57 #include "ui/base/models/menu_model.h" 57 #include "ui/base/models/menu_model.h"
58 #include "views/layout/grid_layout.h" 58 #include "views/layout/grid_layout.h"
59 59
60 using ui::ViewProp; 60 using ui::ViewProp;
61 61
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 DVLOG(1) << __FUNCTION__; 106 DVLOG(1) << __FUNCTION__;
107 } 107 }
108 virtual ~ExternalTabPageInfoBubbleView() { 108 virtual ~ExternalTabPageInfoBubbleView() {
109 DVLOG(1) << __FUNCTION__; 109 DVLOG(1) << __FUNCTION__;
110 } 110 }
111 // LinkListener methods: 111 // LinkListener methods:
112 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE { 112 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE {
113 GURL url = google_util::AppendGoogleLocaleParam( 113 GURL url = google_util::AppendGoogleLocaleParam(
114 GURL(chrome::kPageInfoHelpCenterURL)); 114 GURL(chrome::kPageInfoHelpCenterURL));
115 container_->OpenURLFromTab(container_->tab_contents(), url, GURL(), 115 container_->OpenURLFromTab(container_->tab_contents(), url, GURL(),
116 NEW_FOREGROUND_TAB, PageTransition::LINK); 116 NEW_FOREGROUND_TAB,
117 content::PAGE_TRANSITION_LINK);
117 } 118 }
118 private: 119 private:
119 scoped_refptr<ExternalTabContainer> container_; 120 scoped_refptr<ExternalTabContainer> container_;
120 }; 121 };
121 122
122 base::LazyInstance<ExternalTabContainer::PendingTabs> 123 base::LazyInstance<ExternalTabContainer::PendingTabs>
123 ExternalTabContainer::pending_tabs_(base::LINKER_INITIALIZED); 124 ExternalTabContainer::pending_tabs_(base::LINKER_INITIALIZED);
124 125
125 ExternalTabContainer::ExternalTabContainer( 126 ExternalTabContainer::ExternalTabContainer(
126 AutomationProvider* automation, AutomationResourceMessageFilter* filter) 127 AutomationProvider* automation, AutomationResourceMessageFilter* filter)
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 358 }
358 //////////////////////////////////////////////////////////////////////////////// 359 ////////////////////////////////////////////////////////////////////////////////
359 // ExternalTabContainer, TabContentsDelegate implementation: 360 // ExternalTabContainer, TabContentsDelegate implementation:
360 361
361 // TODO(adriansc): Remove this method once refactoring changed all call sites. 362 // TODO(adriansc): Remove this method once refactoring changed all call sites.
362 TabContents* ExternalTabContainer::OpenURLFromTab( 363 TabContents* ExternalTabContainer::OpenURLFromTab(
363 TabContents* source, 364 TabContents* source,
364 const GURL& url, 365 const GURL& url,
365 const GURL& referrer, 366 const GURL& referrer,
366 WindowOpenDisposition disposition, 367 WindowOpenDisposition disposition,
367 PageTransition::Type transition) { 368 content::PageTransition transition) {
368 return OpenURLFromTab(source, 369 return OpenURLFromTab(source,
369 OpenURLParams(url, referrer, disposition, transition)); 370 OpenURLParams(url, referrer, disposition, transition));
370 } 371 }
371 372
372 TabContents* ExternalTabContainer::OpenURLFromTab(TabContents* source, 373 TabContents* ExternalTabContainer::OpenURLFromTab(TabContents* source,
373 const OpenURLParams& params) { 374 const OpenURLParams& params) {
374 if (pending()) { 375 if (pending()) {
375 pending_open_url_requests_.push_back(params); 376 pending_open_url_requests_.push_back(params);
376 return NULL; 377 return NULL;
377 } 378 }
(...skipping 12 matching lines...) Expand all
390 params.referrer, 391 params.referrer,
391 params.disposition)); 392 params.disposition));
392 // TODO(ananta) 393 // TODO(ananta)
393 // We should populate other fields in the 394 // We should populate other fields in the
394 // ViewHostMsg_FrameNavigate_Params structure. Another option could be 395 // ViewHostMsg_FrameNavigate_Params structure. Another option could be
395 // to refactor the UpdateHistoryForNavigation function in TabContents. 396 // to refactor the UpdateHistoryForNavigation function in TabContents.
396 ViewHostMsg_FrameNavigate_Params nav_params; 397 ViewHostMsg_FrameNavigate_Params nav_params;
397 nav_params.referrer = params.referrer; 398 nav_params.referrer = params.referrer;
398 nav_params.url = params.url; 399 nav_params.url = params.url;
399 nav_params.page_id = -1; 400 nav_params.page_id = -1;
400 nav_params.transition = PageTransition::LINK; 401 nav_params.transition = content::PAGE_TRANSITION_LINK;
401 402
402 content::LoadCommittedDetails details; 403 content::LoadCommittedDetails details;
403 details.did_replace_entry = false; 404 details.did_replace_entry = false;
404 405
405 scoped_refptr<history::HistoryAddPageArgs> add_page_args( 406 scoped_refptr<history::HistoryAddPageArgs> add_page_args(
406 tab_contents_->history_tab_helper()-> 407 tab_contents_->history_tab_helper()->
407 CreateHistoryAddPageArgs(params.url, details, nav_params)); 408 CreateHistoryAddPageArgs(params.url, details, nav_params));
408 tab_contents_->history_tab_helper()-> 409 tab_contents_->history_tab_helper()->
409 UpdateHistoryForNavigation(add_page_args); 410 UpdateHistoryForNavigation(add_page_args);
410 411
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 if (!automation_) 821 if (!automation_)
821 return; 822 return;
822 823
823 static const int kHttpClientErrorStart = 400; 824 static const int kHttpClientErrorStart = 400;
824 static const int kHttpServerErrorEnd = 510; 825 static const int kHttpServerErrorEnd = 510;
825 826
826 switch (type) { 827 switch (type) {
827 case content::NOTIFICATION_LOAD_STOP: { 828 case content::NOTIFICATION_LOAD_STOP: {
828 const LoadNotificationDetails* load = 829 const LoadNotificationDetails* load =
829 Details<LoadNotificationDetails>(details).ptr(); 830 Details<LoadNotificationDetails>(details).ptr();
830 if (load != NULL && PageTransition::IsMainFrame(load->origin())) { 831 if (load != NULL &&
832 content::PageTransitionIsMainFrame(load->origin())) {
831 TRACE_EVENT_END_ETW("ExternalTabContainer::Navigate", 0, 833 TRACE_EVENT_END_ETW("ExternalTabContainer::Navigate", 0,
832 load->url().spec()); 834 load->url().spec());
833 automation_->Send(new AutomationMsg_TabLoaded(tab_handle_, 835 automation_->Send(new AutomationMsg_TabLoaded(tab_handle_,
834 load->url())); 836 load->url()));
835 } 837 }
836 break; 838 break;
837 } 839 }
838 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { 840 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
839 if (ignore_next_load_notification_) { 841 if (ignore_next_load_notification_) {
840 ignore_next_load_notification_ = false; 842 ignore_next_load_notification_ = false;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 1069
1068 void ExternalTabContainer::Navigate(const GURL& url, const GURL& referrer) { 1070 void ExternalTabContainer::Navigate(const GURL& url, const GURL& referrer) {
1069 if (!tab_contents_.get()) { 1071 if (!tab_contents_.get()) {
1070 NOTREACHED(); 1072 NOTREACHED();
1071 return; 1073 return;
1072 } 1074 }
1073 1075
1074 TRACE_EVENT_BEGIN_ETW("ExternalTabContainer::Navigate", 0, url.spec()); 1076 TRACE_EVENT_BEGIN_ETW("ExternalTabContainer::Navigate", 0, url.spec());
1075 1077
1076 tab_contents_->controller().LoadURL(url, referrer, 1078 tab_contents_->controller().LoadURL(url, referrer,
1077 PageTransition::START_PAGE, 1079 content::PAGE_TRANSITION_START_PAGE,
1078 std::string()); 1080 std::string());
1079 } 1081 }
1080 1082
1081 bool ExternalTabContainer::OnGoToEntryOffset(int offset) { 1083 bool ExternalTabContainer::OnGoToEntryOffset(int offset) {
1082 if (load_requests_via_automation_) { 1084 if (load_requests_via_automation_) {
1083 automation_->Send(new AutomationMsg_RequestGoToHistoryEntryOffset( 1085 automation_->Send(new AutomationMsg_RequestGoToHistoryEntryOffset(
1084 tab_handle_, offset)); 1086 tab_handle_, offset));
1085 return false; 1087 return false;
1086 } 1088 }
1087 1089
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 AutomationResourceMessageFilter* filter) 1191 AutomationResourceMessageFilter* filter)
1190 : ExternalTabContainer(automation, filter) { 1192 : ExternalTabContainer(automation, filter) {
1191 } 1193 }
1192 1194
1193 TemporaryPopupExternalTabContainer::~TemporaryPopupExternalTabContainer() { 1195 TemporaryPopupExternalTabContainer::~TemporaryPopupExternalTabContainer() {
1194 DVLOG(1) << __FUNCTION__; 1196 DVLOG(1) << __FUNCTION__;
1195 } 1197 }
1196 1198
1197 TabContents* TemporaryPopupExternalTabContainer::OpenURLFromTab( 1199 TabContents* TemporaryPopupExternalTabContainer::OpenURLFromTab(
1198 TabContents* source, const GURL& url, const GURL& referrer, 1200 TabContents* source, const GURL& url, const GURL& referrer,
1199 WindowOpenDisposition disposition, PageTransition::Type transition) { 1201 WindowOpenDisposition disposition, content::PageTransition transition) {
1200 return OpenURLFromTab(source, 1202 return OpenURLFromTab(source,
1201 OpenURLParams(url, referrer, disposition, transition)); 1203 OpenURLParams(url, referrer, disposition, transition));
1202 } 1204 }
1203 1205
1204 TabContents* TemporaryPopupExternalTabContainer::OpenURLFromTab( 1206 TabContents* TemporaryPopupExternalTabContainer::OpenURLFromTab(
1205 TabContents* source, 1207 TabContents* source,
1206 const OpenURLParams& params) { 1208 const OpenURLParams& params) {
1207 if (!automation_) 1209 if (!automation_)
1208 return NULL; 1210 return NULL;
1209 1211
1210 OpenURLParams forward_params = params; 1212 OpenURLParams forward_params = params;
1211 if (params.disposition == CURRENT_TAB) { 1213 if (params.disposition == CURRENT_TAB) {
1212 DCHECK(route_all_top_level_navigations_); 1214 DCHECK(route_all_top_level_navigations_);
1213 forward_params.disposition = NEW_FOREGROUND_TAB; 1215 forward_params.disposition = NEW_FOREGROUND_TAB;
1214 } 1216 }
1215 TabContents* new_contents = 1217 TabContents* new_contents =
1216 ExternalTabContainer::OpenURLFromTab(source, forward_params); 1218 ExternalTabContainer::OpenURLFromTab(source, forward_params);
1217 // support only one navigation for a dummy tab before it is killed. 1219 // support only one navigation for a dummy tab before it is killed.
1218 ::DestroyWindow(GetNativeView()); 1220 ::DestroyWindow(GetNativeView());
1219 return new_contents; 1221 return new_contents;
1220 } 1222 }
OLDNEW
« no previous file with comments | « chrome/browser/external_tab_container_win.h ('k') | chrome/browser/geolocation/chrome_geolocation_permission_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698