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

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

Issue 12212120: Replace most BrowserList::empty() and BrowserList::size() calls by multi-desktop aware calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 92 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
93 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" 93 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
94 #include "chrome/browser/ui/browser_command_controller.h" 94 #include "chrome/browser/ui/browser_command_controller.h"
95 #include "chrome/browser/ui/browser_commands.h" 95 #include "chrome/browser/ui/browser_commands.h"
96 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" 96 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
97 #include "chrome/browser/ui/browser_dialogs.h" 97 #include "chrome/browser/ui/browser_dialogs.h"
98 #include "chrome/browser/ui/browser_finder.h" 98 #include "chrome/browser/ui/browser_finder.h"
99 #include "chrome/browser/ui/browser_instant_controller.h" 99 #include "chrome/browser/ui/browser_instant_controller.h"
100 #include "chrome/browser/ui/browser_iterator.h" 100 #include "chrome/browser/ui/browser_iterator.h"
101 #include "chrome/browser/ui/browser_list.h" 101 #include "chrome/browser/ui/browser_list.h"
102 #include "chrome/browser/ui/browser_list_impl.h"
102 #include "chrome/browser/ui/browser_navigator.h" 103 #include "chrome/browser/ui/browser_navigator.h"
103 #include "chrome/browser/ui/browser_tab_contents.h" 104 #include "chrome/browser/ui/browser_tab_contents.h"
104 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" 105 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h"
105 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h" 106 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h"
106 #include "chrome/browser/ui/browser_tabstrip.h" 107 #include "chrome/browser/ui/browser_tabstrip.h"
107 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" 108 #include "chrome/browser/ui/browser_toolbar_model_delegate.h"
108 #include "chrome/browser/ui/browser_ui_prefs.h" 109 #include "chrome/browser/ui/browser_ui_prefs.h"
109 #include "chrome/browser/ui/browser_window.h" 110 #include "chrome/browser/ui/browser_window.h"
110 #include "chrome/browser/ui/chrome_pages.h" 111 #include "chrome/browser/ui/chrome_pages.h"
111 #include "chrome/browser/ui/chrome_select_file_policy.h" 112 #include "chrome/browser/ui/chrome_select_file_policy.h"
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 if (!ShouldCloseWindow()) 633 if (!ShouldCloseWindow())
633 return; 634 return;
634 635
635 // Application should shutdown on last window close if the user is explicitly 636 // Application should shutdown on last window close if the user is explicitly
636 // trying to quit, or if there is nothing keeping the browser alive (such as 637 // trying to quit, or if there is nothing keeping the browser alive (such as
637 // AppController on the Mac, or BackgroundContentsService for background 638 // AppController on the Mac, or BackgroundContentsService for background
638 // pages). 639 // pages).
639 bool should_quit_if_last_browser = 640 bool should_quit_if_last_browser =
640 browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive(); 641 browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive();
641 642
642 if (should_quit_if_last_browser && BrowserList::size() == 1) 643 if (should_quit_if_last_browser &&
644 chrome::BrowserListImpl::GetInstance(host_desktop_type_)->size() == 1) {
643 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE); 645 browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE);
646 }
644 647
645 // Don't use GetForProfileIfExisting here, we want to force creation of the 648 // Don't use GetForProfileIfExisting here, we want to force creation of the
646 // session service so that user can restore what was open. 649 // session service so that user can restore what was open.
647 SessionService* session_service = 650 SessionService* session_service =
648 SessionServiceFactory::GetForProfile(profile()); 651 SessionServiceFactory::GetForProfile(profile());
649 if (session_service) 652 if (session_service)
650 session_service->WindowClosing(session_id()); 653 session_service->WindowClosing(session_id());
651 654
652 TabRestoreService* tab_restore_service = 655 TabRestoreService* tab_restore_service =
653 TabRestoreServiceFactory::GetForProfile(profile()); 656 TabRestoreServiceFactory::GetForProfile(profile());
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 if (contents && !allow_js_access) { 2339 if (contents && !allow_js_access) {
2337 contents->web_contents()->GetController().LoadURL( 2340 contents->web_contents()->GetController().LoadURL(
2338 target_url, 2341 target_url,
2339 content::Referrer(), 2342 content::Referrer(),
2340 content::PAGE_TRANSITION_LINK, 2343 content::PAGE_TRANSITION_LINK,
2341 std::string()); // No extra headers. 2344 std::string()); // No extra headers.
2342 } 2345 }
2343 2346
2344 return contents != NULL; 2347 return contents != NULL;
2345 } 2348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698