| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "chrome/browser/google/google_util.h" | 53 #include "chrome/browser/google/google_util.h" |
| 54 #include "chrome/browser/instant/instant_controller.h" | 54 #include "chrome/browser/instant/instant_controller.h" |
| 55 #include "chrome/browser/instant/instant_unload_handler.h" | 55 #include "chrome/browser/instant/instant_unload_handler.h" |
| 56 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" | 56 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" |
| 57 #include "chrome/browser/net/browser_url_util.h" | 57 #include "chrome/browser/net/browser_url_util.h" |
| 58 #include "chrome/browser/net/url_fixer_upper.h" | 58 #include "chrome/browser/net/url_fixer_upper.h" |
| 59 #include "chrome/browser/notifications/notification_ui_manager.h" | 59 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 60 #include "chrome/browser/platform_util.h" | 60 #include "chrome/browser/platform_util.h" |
| 61 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 61 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 62 #include "chrome/browser/prefs/pref_service.h" | 62 #include "chrome/browser/prefs/pref_service.h" |
| 63 #include "chrome/browser/printing/background_printing_manager.h" |
| 63 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | 64 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
| 64 #include "chrome/browser/printing/print_preview_tab_controller.h" | 65 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 65 #include "chrome/browser/profiles/profile.h" | 66 #include "chrome/browser/profiles/profile.h" |
| 66 #include "chrome/browser/sessions/restore_tab_helper.h" | 67 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 67 #include "chrome/browser/sessions/session_service.h" | 68 #include "chrome/browser/sessions/session_service.h" |
| 68 #include "chrome/browser/sessions/session_service_factory.h" | 69 #include "chrome/browser/sessions/session_service_factory.h" |
| 69 #include "chrome/browser/sessions/session_types.h" | 70 #include "chrome/browser/sessions/session_types.h" |
| 70 #include "chrome/browser/sessions/tab_restore_service.h" | 71 #include "chrome/browser/sessions/tab_restore_service.h" |
| 71 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 72 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 72 #include "chrome/browser/sync/profile_sync_service.h" | 73 #include "chrome/browser/sync/profile_sync_service.h" |
| (...skipping 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3398 void Browser::CloseContents(TabContents* source) { | 3399 void Browser::CloseContents(TabContents* source) { |
| 3399 if (is_attempting_to_close_browser_) { | 3400 if (is_attempting_to_close_browser_) { |
| 3400 // If we're trying to close the browser, just clear the state related to | 3401 // If we're trying to close the browser, just clear the state related to |
| 3401 // waiting for unload to fire. Don't actually try to close the tab as it | 3402 // waiting for unload to fire. Don't actually try to close the tab as it |
| 3402 // will go down the slow shutdown path instead of the fast path of killing | 3403 // will go down the slow shutdown path instead of the fast path of killing |
| 3403 // all the renderer processes. | 3404 // all the renderer processes. |
| 3404 ClearUnloadState(source, true); | 3405 ClearUnloadState(source, true); |
| 3405 return; | 3406 return; |
| 3406 } | 3407 } |
| 3407 | 3408 |
| 3409 // Various sites have a pattern which open a new window with output formatted |
| 3410 // for printing, then include a print button, which does window.print(); |
| 3411 // window.close(); An example is printing Virgin America boarding |
| 3412 // pass. Instead of closing, when a print tab is associated with this tab, |
| 3413 // tell the BackgroundPrintingManager to own it, which causes it to be |
| 3414 // hidden and eventually closed when the print window is closed. |
| 3415 TabContentsWrapper* tab_wrapper = |
| 3416 TabContentsWrapper::GetCurrentWrapperForContents(source); |
| 3417 if (g_browser_process->background_printing_manager()-> |
| 3418 OwnInitiatorTabContents(tab_wrapper)) { |
| 3419 return; |
| 3420 } |
| 3421 |
| 3408 int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source); | 3422 int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source); |
| 3409 if (index == TabStripModel::kNoTab) { | 3423 if (index == TabStripModel::kNoTab) { |
| 3410 NOTREACHED() << "CloseContents called for tab not in our strip"; | 3424 NOTREACHED() << "CloseContents called for tab not in our strip"; |
| 3411 return; | 3425 return; |
| 3412 } | 3426 } |
| 3413 tab_handler_->GetTabStripModel()->CloseTabContentsAt( | 3427 tab_handler_->GetTabStripModel()->CloseTabContentsAt( |
| 3414 index, | 3428 index, |
| 3415 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); | 3429 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); |
| 3416 } | 3430 } |
| 3417 | 3431 |
| (...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5116 } | 5130 } |
| 5117 | 5131 |
| 5118 void Browser::ShowSyncSetup() { | 5132 void Browser::ShowSyncSetup() { |
| 5119 ProfileSyncService* service = | 5133 ProfileSyncService* service = |
| 5120 profile()->GetOriginalProfile()->GetProfileSyncService(); | 5134 profile()->GetOriginalProfile()->GetProfileSyncService(); |
| 5121 if (service->HasSyncSetupCompleted()) | 5135 if (service->HasSyncSetupCompleted()) |
| 5122 ShowOptionsTab(chrome::kSyncSetupSubPage); | 5136 ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 5123 else | 5137 else |
| 5124 service->ShowLoginDialog(); | 5138 service->ShowLoginDialog(); |
| 5125 } | 5139 } |
| OLD | NEW |