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 "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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 #include "chrome/browser/google/google_url_tracker.h" | 48 #include "chrome/browser/google/google_url_tracker.h" |
| 49 #include "chrome/browser/google/google_util.h" | 49 #include "chrome/browser/google/google_util.h" |
| 50 #include "chrome/browser/instant/instant_controller.h" | 50 #include "chrome/browser/instant/instant_controller.h" |
| 51 #include "chrome/browser/instant/instant_unload_handler.h" | 51 #include "chrome/browser/instant/instant_unload_handler.h" |
| 52 #include "chrome/browser/net/browser_url_util.h" | 52 #include "chrome/browser/net/browser_url_util.h" |
| 53 #include "chrome/browser/net/url_fixer_upper.h" | 53 #include "chrome/browser/net/url_fixer_upper.h" |
| 54 #include "chrome/browser/notifications/notification_ui_manager.h" | 54 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 55 #include "chrome/browser/platform_util.h" | 55 #include "chrome/browser/platform_util.h" |
| 56 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 56 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 57 #include "chrome/browser/prefs/pref_service.h" | 57 #include "chrome/browser/prefs/pref_service.h" |
| 58 #include "chrome/browser/printing/background_printing_manager.h" | |
| 58 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | 59 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
| 60 #include "chrome/browser/printing/print_preview_tab_controller.h" | |
| 59 #include "chrome/browser/profiles/profile.h" | 61 #include "chrome/browser/profiles/profile.h" |
| 60 #include "chrome/browser/sessions/restore_tab_helper.h" | 62 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 61 #include "chrome/browser/sessions/session_service.h" | 63 #include "chrome/browser/sessions/session_service.h" |
| 62 #include "chrome/browser/sessions/session_service_factory.h" | 64 #include "chrome/browser/sessions/session_service_factory.h" |
| 63 #include "chrome/browser/sessions/session_types.h" | 65 #include "chrome/browser/sessions/session_types.h" |
| 64 #include "chrome/browser/sessions/tab_restore_service.h" | 66 #include "chrome/browser/sessions/tab_restore_service.h" |
| 65 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 67 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 66 #include "chrome/browser/sync/profile_sync_service.h" | 68 #include "chrome/browser/sync/profile_sync_service.h" |
| 67 #include "chrome/browser/sync/sync_ui_util.h" | 69 #include "chrome/browser/sync/sync_ui_util.h" |
| 68 #include "chrome/browser/tab_closeable_state_watcher.h" | 70 #include "chrome/browser/tab_closeable_state_watcher.h" |
| (...skipping 3154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3223 void Browser::CloseContents(TabContents* source) { | 3225 void Browser::CloseContents(TabContents* source) { |
| 3224 if (is_attempting_to_close_browser_) { | 3226 if (is_attempting_to_close_browser_) { |
| 3225 // If we're trying to close the browser, just clear the state related to | 3227 // If we're trying to close the browser, just clear the state related to |
| 3226 // waiting for unload to fire. Don't actually try to close the tab as it | 3228 // waiting for unload to fire. Don't actually try to close the tab as it |
| 3227 // will go down the slow shutdown path instead of the fast path of killing | 3229 // will go down the slow shutdown path instead of the fast path of killing |
| 3228 // all the renderer processes. | 3230 // all the renderer processes. |
| 3229 ClearUnloadState(source, true); | 3231 ClearUnloadState(source, true); |
| 3230 return; | 3232 return; |
| 3231 } | 3233 } |
| 3232 | 3234 |
| 3235 TabContentsWrapper* tab_wrapper = | |
|
Lei Zhang
2011/08/26 10:01:54
Please add a comment here to explain what's going
Sheridan Rawlins
2011/08/26 23:45:39
Done.
| |
| 3236 TabContentsWrapper::GetCurrentWrapperForContents(source); | |
| 3237 if (g_browser_process->background_printing_manager()-> | |
| 3238 OwnInitiatorTabContents(tab_wrapper)) { | |
| 3239 return; | |
| 3240 } | |
| 3241 | |
| 3233 int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source); | 3242 int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source); |
| 3234 if (index == TabStripModel::kNoTab) { | 3243 if (index == TabStripModel::kNoTab) { |
| 3235 NOTREACHED() << "CloseContents called for tab not in our strip"; | 3244 NOTREACHED() << "CloseContents called for tab not in our strip"; |
| 3236 return; | 3245 return; |
| 3237 } | 3246 } |
| 3238 tab_handler_->GetTabStripModel()->CloseTabContentsAt( | 3247 tab_handler_->GetTabStripModel()->CloseTabContentsAt( |
| 3239 index, | 3248 index, |
| 3240 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); | 3249 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); |
| 3241 } | 3250 } |
| 3242 | 3251 |
| (...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4875 } | 4884 } |
| 4876 | 4885 |
| 4877 void Browser::ShowSyncSetup() { | 4886 void Browser::ShowSyncSetup() { |
| 4878 ProfileSyncService* service = | 4887 ProfileSyncService* service = |
| 4879 profile()->GetOriginalProfile()->GetProfileSyncService(); | 4888 profile()->GetOriginalProfile()->GetProfileSyncService(); |
| 4880 if (service->HasSyncSetupCompleted()) | 4889 if (service->HasSyncSetupCompleted()) |
| 4881 ShowOptionsTab(chrome::kSyncSetupSubPage); | 4890 ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 4882 else | 4891 else |
| 4883 service->ShowLoginDialog(); | 4892 service->ShowLoginDialog(); |
| 4884 } | 4893 } |
| OLD | NEW |