OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 #include "chrome/browser/ui/omnibox/location_bar.h" | 120 #include "chrome/browser/ui/omnibox/location_bar.h" |
121 #include "chrome/browser/ui/panels/panel.h" | 121 #include "chrome/browser/ui/panels/panel.h" |
122 #include "chrome/browser/ui/panels/panel_manager.h" | 122 #include "chrome/browser/ui/panels/panel_manager.h" |
123 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 123 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
124 #include "chrome/browser/ui/singleton_tabs.h" | 124 #include "chrome/browser/ui/singleton_tabs.h" |
125 #include "chrome/browser/ui/status_bubble.h" | 125 #include "chrome/browser/ui/status_bubble.h" |
126 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" | 126 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
127 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 127 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
128 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 128 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
129 #include "chrome/browser/ui/tabs/dock_info.h" | 129 #include "chrome/browser/ui/tabs/dock_info.h" |
130 #include "chrome/browser/ui/tabs/tab_finder.h" | |
131 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 130 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
132 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 131 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
133 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 132 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
134 #include "chrome/browser/ui/webui/feedback_ui.h" | 133 #include "chrome/browser/ui/webui/feedback_ui.h" |
135 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 134 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
136 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 135 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
137 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 136 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
138 #include "chrome/browser/ui/window_sizer.h" | 137 #include "chrome/browser/ui/window_sizer.h" |
139 #include "chrome/browser/upgrade_detector.h" | 138 #include "chrome/browser/upgrade_detector.h" |
140 #include "chrome/browser/web_applications/web_app.h" | 139 #include "chrome/browser/web_applications/web_app.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 TabRestoreServiceChanged(tab_restore_service_); | 422 TabRestoreServiceChanged(tab_restore_service_); |
424 } | 423 } |
425 | 424 |
426 ProfileSyncService* service = | 425 ProfileSyncService* service = |
427 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); | 426 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); |
428 if (service) | 427 if (service) |
429 service->AddObserver(this); | 428 service->AddObserver(this); |
430 | 429 |
431 CreateInstantIfNecessary(); | 430 CreateInstantIfNecessary(); |
432 | 431 |
433 // Make sure TabFinder has been created. This does nothing if TabFinder is | |
434 // not enabled. | |
435 TabFinder::GetInstance(); | |
436 | |
437 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_INIT); | 432 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_INIT); |
438 | 433 |
439 FilePath profile_path = profile->GetPath(); | 434 FilePath profile_path = profile->GetPath(); |
440 ProfileMetrics::LogProfileLaunch(profile_path); | 435 ProfileMetrics::LogProfileLaunch(profile_path); |
441 } | 436 } |
442 | 437 |
443 Browser::~Browser() { | 438 Browser::~Browser() { |
444 ProfileSyncService* service = | 439 ProfileSyncService* service = |
445 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); | 440 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); |
446 if (service) | 441 if (service) |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 if (!location_bar) | 1235 if (!location_bar) |
1241 return; | 1236 return; |
1242 | 1237 |
1243 WindowOpenDisposition open_disposition = | 1238 WindowOpenDisposition open_disposition = |
1244 location_bar->GetWindowOpenDisposition(); | 1239 location_bar->GetWindowOpenDisposition(); |
1245 if (OpenInstant(open_disposition)) | 1240 if (OpenInstant(open_disposition)) |
1246 return; | 1241 return; |
1247 | 1242 |
1248 GURL url(location_bar->GetInputString()); | 1243 GURL url(location_bar->GetInputString()); |
1249 | 1244 |
1250 if (open_disposition == CURRENT_TAB && TabFinder::IsEnabled()) { | |
1251 Browser* existing_browser = NULL; | |
1252 WebContents* existing_tab = TabFinder::GetInstance()->FindTab( | |
1253 this, url, &existing_browser); | |
1254 if (existing_tab) { | |
1255 existing_browser->ActivateContents(existing_tab); | |
1256 return; | |
1257 } | |
1258 } | |
1259 | |
1260 browser::NavigateParams params(this, url, location_bar->GetPageTransition()); | 1245 browser::NavigateParams params(this, url, location_bar->GetPageTransition()); |
1261 params.disposition = open_disposition; | 1246 params.disposition = open_disposition; |
1262 // Use ADD_INHERIT_OPENER so that all pages opened by the omnibox at least | 1247 // Use ADD_INHERIT_OPENER so that all pages opened by the omnibox at least |
1263 // inherit the opener. In some cases the tabstrip will determine the group | 1248 // inherit the opener. In some cases the tabstrip will determine the group |
1264 // should be inherited, in which case the group is inherited instead of the | 1249 // should be inherited, in which case the group is inherited instead of the |
1265 // opener. | 1250 // opener. |
1266 params.tabstrip_add_types = | 1251 params.tabstrip_add_types = |
1267 TabStripModel::ADD_FORCE_INDEX | TabStripModel::ADD_INHERIT_OPENER; | 1252 TabStripModel::ADD_FORCE_INDEX | TabStripModel::ADD_INHERIT_OPENER; |
1268 browser::Navigate(¶ms); | 1253 browser::Navigate(¶ms); |
1269 | 1254 |
(...skipping 3671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4941 if (contents && !allow_js_access) { | 4926 if (contents && !allow_js_access) { |
4942 contents->web_contents()->GetController().LoadURL( | 4927 contents->web_contents()->GetController().LoadURL( |
4943 target_url, | 4928 target_url, |
4944 content::Referrer(), | 4929 content::Referrer(), |
4945 content::PAGE_TRANSITION_LINK, | 4930 content::PAGE_TRANSITION_LINK, |
4946 std::string()); // No extra headers. | 4931 std::string()); // No extra headers. |
4947 } | 4932 } |
4948 | 4933 |
4949 return contents != NULL; | 4934 return contents != NULL; |
4950 } | 4935 } |
OLD | NEW |