Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 #include "chrome/common/chrome_switches.h" | 143 #include "chrome/common/chrome_switches.h" |
| 144 #include "chrome/common/custom_handlers/protocol_handler.h" | 144 #include "chrome/common/custom_handlers/protocol_handler.h" |
| 145 #include "chrome/common/pref_names.h" | 145 #include "chrome/common/pref_names.h" |
| 146 #include "chrome/common/profiling.h" | 146 #include "chrome/common/profiling.h" |
| 147 #include "chrome/common/search_types.h" | 147 #include "chrome/common/search_types.h" |
| 148 #include "chrome/common/url_constants.h" | 148 #include "chrome/common/url_constants.h" |
| 149 #include "components/bookmarks/browser/bookmark_model.h" | 149 #include "components/bookmarks/browser/bookmark_model.h" |
| 150 #include "components/bookmarks/browser/bookmark_utils.h" | 150 #include "components/bookmarks/browser/bookmark_utils.h" |
| 151 #include "components/google/core/browser/google_url_tracker.h" | 151 #include "components/google/core/browser/google_url_tracker.h" |
| 152 #include "components/startup_metric_utils/startup_metric_utils.h" | 152 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 153 #include "components/web_modal/popup_manager.h" | |
| 153 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 154 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 154 #include "content/public/browser/devtools_manager.h" | 155 #include "content/public/browser/devtools_manager.h" |
| 155 #include "content/public/browser/download_item.h" | 156 #include "content/public/browser/download_item.h" |
| 156 #include "content/public/browser/download_manager.h" | 157 #include "content/public/browser/download_manager.h" |
| 157 #include "content/public/browser/interstitial_page.h" | 158 #include "content/public/browser/interstitial_page.h" |
| 158 #include "content/public/browser/invalidate_type.h" | 159 #include "content/public/browser/invalidate_type.h" |
| 159 #include "content/public/browser/navigation_controller.h" | 160 #include "content/public/browser/navigation_controller.h" |
| 160 #include "content/public/browser/navigation_entry.h" | 161 #include "content/public/browser/navigation_entry.h" |
| 161 #include "content/public/browser/notification_details.h" | 162 #include "content/public/browser/notification_details.h" |
| 162 #include "content/public/browser/notification_service.h" | 163 #include "content/public/browser/notification_service.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 // TODO(beng): move to ChromeBrowserMain: | 436 // TODO(beng): move to ChromeBrowserMain: |
| 436 if (first_run::ShouldDoPersonalDataManagerFirstRun()) { | 437 if (first_run::ShouldDoPersonalDataManagerFirstRun()) { |
| 437 #if defined(OS_WIN) | 438 #if defined(OS_WIN) |
| 438 // Notify PDM that this is a first run. | 439 // Notify PDM that this is a first run. |
| 439 ImportAutofillDataWin( | 440 ImportAutofillDataWin( |
| 440 autofill::PersonalDataManagerFactory::GetForProfile(profile_)); | 441 autofill::PersonalDataManagerFactory::GetForProfile(profile_)); |
| 441 #endif // defined(OS_WIN) | 442 #endif // defined(OS_WIN) |
| 442 } | 443 } |
| 443 | 444 |
| 444 fullscreen_controller_.reset(new FullscreenController(this)); | 445 fullscreen_controller_.reset(new FullscreenController(this)); |
| 446 | |
| 447 // Must be initialized after window_. | |
| 448 // This would be a DCHECK but tests. | |
| 449 if (GetWebContentsModalDialogHost()) { | |
| 450 popup_manager_.reset(new web_modal::PopupManager( | |
| 451 GetWebContentsModalDialogHost())); | |
| 452 } | |
| 445 } | 453 } |
| 446 | 454 |
| 447 Browser::~Browser() { | 455 Browser::~Browser() { |
| 448 // Stop observing notifications before continuing with destruction. Profile | 456 // Stop observing notifications before continuing with destruction. Profile |
| 449 // destruction will unload extensions and reentrant calls to Browser:: should | 457 // destruction will unload extensions and reentrant calls to Browser:: should |
| 450 // be avoided while it is being torn down. | 458 // be avoided while it is being torn down. |
| 451 registrar_.RemoveAll(); | 459 registrar_.RemoveAll(); |
| 452 | 460 |
| 453 // The tab strip should not have any tabs at this point. | 461 // The tab strip should not have any tabs at this point. |
| 454 DCHECK(tab_strip_model_->empty()); | 462 DCHECK(tab_strip_model_->empty()); |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 883 return OpenURLFromTab(NULL, params); | 891 return OpenURLFromTab(NULL, params); |
| 884 } | 892 } |
| 885 | 893 |
| 886 /////////////////////////////////////////////////////////////////////////////// | 894 /////////////////////////////////////////////////////////////////////////////// |
| 887 // Browser, TabStripModelObserver implementation: | 895 // Browser, TabStripModelObserver implementation: |
| 888 | 896 |
| 889 void Browser::TabInsertedAt(WebContents* contents, | 897 void Browser::TabInsertedAt(WebContents* contents, |
| 890 int index, | 898 int index, |
| 891 bool foreground) { | 899 bool foreground) { |
| 892 SetAsDelegate(contents, this); | 900 SetAsDelegate(contents, this); |
| 901 | |
| 902 if (popup_manager_.get()) | |
| 903 popup_manager_->RegisterWith(contents); | |
|
Mike Wittman
2014/06/25 02:38:50
The WCMDM is disassociated from the Browser on tab
Greg Billock
2014/06/25 19:06:14
Oh, I see what your saying -- it needs an api meth
Mike Wittman
2014/06/25 21:12:44
Yes, this behavior is unique to Browser.
| |
| 904 | |
| 893 SessionTabHelper* session_tab_helper = | 905 SessionTabHelper* session_tab_helper = |
| 894 SessionTabHelper::FromWebContents(contents); | 906 SessionTabHelper::FromWebContents(contents); |
| 895 session_tab_helper->SetWindowID(session_id()); | 907 session_tab_helper->SetWindowID(session_id()); |
| 896 | 908 |
| 897 content::NotificationService::current()->Notify( | 909 content::NotificationService::current()->Notify( |
| 898 chrome::NOTIFICATION_TAB_PARENTED, | 910 chrome::NOTIFICATION_TAB_PARENTED, |
| 899 content::Source<content::WebContents>(contents), | 911 content::Source<content::WebContents>(contents), |
| 900 content::NotificationService::NoDetails()); | 912 content::NotificationService::NoDetails()); |
| 901 | 913 |
| 902 SyncHistoryWithTabs(index); | 914 SyncHistoryWithTabs(index); |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2417 if (contents && !allow_js_access) { | 2429 if (contents && !allow_js_access) { |
| 2418 contents->web_contents()->GetController().LoadURL( | 2430 contents->web_contents()->GetController().LoadURL( |
| 2419 target_url, | 2431 target_url, |
| 2420 content::Referrer(), | 2432 content::Referrer(), |
| 2421 content::PAGE_TRANSITION_LINK, | 2433 content::PAGE_TRANSITION_LINK, |
| 2422 std::string()); // No extra headers. | 2434 std::string()); // No extra headers. |
| 2423 } | 2435 } |
| 2424 | 2436 |
| 2425 return contents != NULL; | 2437 return contents != NULL; |
| 2426 } | 2438 } |
| OLD | NEW |