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

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

Issue 1336823003: Move chrome::HostDesktopType to ui::HostDesktopType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base_session_service_delegate_impl
Patch Set: Fix build on Mac and CrOS Created 5 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ash/chrome_new_window_delegate.h" 5 #include "chrome/browser/ui/ash/chrome_new_window_delegate.h"
6 6
7 #include "ash/wm/window_util.h" 7 #include "ash/wm/window_util.h"
8 #include "chrome/browser/profiles/profile_manager.h" 8 #include "chrome/browser/profiles/profile_manager.h"
9 #include "chrome/browser/sessions/tab_restore_service.h" 9 #include "chrome/browser/sessions/tab_restore_service.h"
10 #include "chrome/browser/sessions/tab_restore_service_factory.h" 10 #include "chrome/browser/sessions/tab_restore_service_factory.h"
11 #include "chrome/browser/sessions/tab_restore_service_observer.h" 11 #include "chrome/browser/sessions/tab_restore_service_observer.h"
12 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" 12 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_commands.h" 14 #include "chrome/browser/ui/browser_commands.h"
15 #include "chrome/browser/ui/browser_finder.h" 15 #include "chrome/browser/ui/browser_finder.h"
16 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 17 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
18 18
19 namespace { 19 namespace {
20 20
21 void RestoreTabUsingProfile(Profile* profile) { 21 void RestoreTabUsingProfile(Profile* profile) {
22 TabRestoreService* service = TabRestoreServiceFactory::GetForProfile(profile); 22 TabRestoreService* service = TabRestoreServiceFactory::GetForProfile(profile);
23 service->RestoreMostRecentEntry(NULL, chrome::HOST_DESKTOP_TYPE_ASH); 23 service->RestoreMostRecentEntry(NULL, ui::HOST_DESKTOP_TYPE_ASH);
24 } 24 }
25 25
26 // Returns the browser for the active window, if any. 26 // Returns the browser for the active window, if any.
27 Browser* GetBrowserForActiveWindow() { 27 Browser* GetBrowserForActiveWindow() {
28 return chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); 28 return chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow());
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 ChromeNewWindowDelegate::ChromeNewWindowDelegate() {} 33 ChromeNewWindowDelegate::ChromeNewWindowDelegate() {}
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void ChromeNewWindowDelegate::NewTab() { 77 void ChromeNewWindowDelegate::NewTab() {
78 Browser* browser = GetBrowserForActiveWindow(); 78 Browser* browser = GetBrowserForActiveWindow();
79 if (browser && browser->is_type_tabbed()) { 79 if (browser && browser->is_type_tabbed()) {
80 chrome::NewTab(browser); 80 chrome::NewTab(browser);
81 return; 81 return;
82 } 82 }
83 83
84 // Display a browser, setting the focus to the location bar after it is shown. 84 // Display a browser, setting the focus to the location bar after it is shown.
85 { 85 {
86 chrome::ScopedTabbedBrowserDisplayer displayer( 86 chrome::ScopedTabbedBrowserDisplayer displayer(
87 ProfileManager::GetActiveUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH); 87 ProfileManager::GetActiveUserProfile(), ui::HOST_DESKTOP_TYPE_ASH);
88 browser = displayer.browser(); 88 browser = displayer.browser();
89 chrome::NewTab(browser); 89 chrome::NewTab(browser);
90 } 90 }
91 91
92 browser->SetFocusToLocationBar(false); 92 browser->SetFocusToLocationBar(false);
93 } 93 }
94 94
95 void ChromeNewWindowDelegate::NewWindow(bool is_incognito) { 95 void ChromeNewWindowDelegate::NewWindow(bool is_incognito) {
96 Profile* profile = ProfileManager::GetActiveUserProfile(); 96 Profile* profile = ProfileManager::GetActiveUserProfile();
97 chrome::NewEmptyWindow( 97 chrome::NewEmptyWindow(
98 is_incognito ? profile->GetOffTheRecordProfile() : profile, 98 is_incognito ? profile->GetOffTheRecordProfile() : profile,
99 chrome::HOST_DESKTOP_TYPE_ASH); 99 ui::HOST_DESKTOP_TYPE_ASH);
100 } 100 }
101 101
102 void ChromeNewWindowDelegate::RestoreTab() { 102 void ChromeNewWindowDelegate::RestoreTab() {
103 if (tab_restore_helper_.get()) { 103 if (tab_restore_helper_.get()) {
104 DCHECK(!tab_restore_helper_->tab_restore_service()->IsLoaded()); 104 DCHECK(!tab_restore_helper_->tab_restore_service()->IsLoaded());
105 return; 105 return;
106 } 106 }
107 107
108 Browser* browser = GetBrowserForActiveWindow(); 108 Browser* browser = GetBrowserForActiveWindow();
109 Profile* profile = browser ? browser->profile() : NULL; 109 Profile* profile = browser ? browser->profile() : NULL;
(...skipping 14 matching lines...) Expand all
124 } 124 }
125 } 125 }
126 126
127 void ChromeNewWindowDelegate::ShowTaskManager() { 127 void ChromeNewWindowDelegate::ShowTaskManager() {
128 chrome::OpenTaskManager(NULL); 128 chrome::OpenTaskManager(NULL);
129 } 129 }
130 130
131 void ChromeNewWindowDelegate::OpenFeedbackPage() { 131 void ChromeNewWindowDelegate::OpenFeedbackPage() {
132 chrome::OpenFeedbackDialog(GetBrowserForActiveWindow()); 132 chrome::OpenFeedbackDialog(GetBrowserForActiveWindow());
133 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698