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

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

Issue 2549903002: mash: Reverse the responsibilities of the NewWindowClient. (Closed)
Patch Set: jamescook comments Created 4 years 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_client.h" 5 #include "chrome/browser/ui/ash/chrome_new_window_client.h"
6 6
7 #include "ash/content/keyboard_overlay/keyboard_overlay_view.h" 7 #include "ash/content/keyboard_overlay/keyboard_overlay_view.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/chromeos/file_manager/app_id.h" 9 #include "chrome/browser/chromeos/file_manager/app_id.h"
10 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" 10 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_util.h" 12 #include "chrome/browser/extensions/extension_util.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/sessions/tab_restore_service_factory.h" 14 #include "chrome/browser/sessions/tab_restore_service_factory.h"
15 #include "chrome/browser/ui/ash/ash_util.h"
15 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" 16 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
16 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_commands.h" 18 #include "chrome/browser/ui/browser_commands.h"
18 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
19 #include "chrome/browser/ui/browser_list.h" 20 #include "chrome/browser/ui/browser_list.h"
20 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/browser/ui/chrome_pages.h" 22 #include "chrome/browser/ui/chrome_pages.h"
22 #include "chrome/browser/ui/extensions/app_launch_params.h" 23 #include "chrome/browser/ui/extensions/app_launch_params.h"
23 #include "chrome/browser/ui/extensions/application_launch.h" 24 #include "chrome/browser/ui/extensions/application_launch.h"
24 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 25 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
25 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" 26 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
26 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
27 #include "components/sessions/core/tab_restore_service.h" 28 #include "components/sessions/core/tab_restore_service.h"
28 #include "components/sessions/core/tab_restore_service_observer.h" 29 #include "components/sessions/core/tab_restore_service_observer.h"
29 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
31 #include "content/public/common/service_manager_connection.h"
32 #include "content/public/common/service_names.mojom.h"
30 #include "extensions/browser/extension_system.h" 33 #include "extensions/browser/extension_system.h"
31 #include "extensions/common/constants.h" 34 #include "extensions/common/constants.h"
35 #include "services/service_manager/public/cpp/connector.h"
32 #include "ui/base/window_open_disposition.h" 36 #include "ui/base/window_open_disposition.h"
33 37
34 namespace { 38 namespace {
35 39
36 void RestoreTabUsingProfile(Profile* profile) { 40 void RestoreTabUsingProfile(Profile* profile) {
37 sessions::TabRestoreService* service = 41 sessions::TabRestoreService* service =
38 TabRestoreServiceFactory::GetForProfile(profile); 42 TabRestoreServiceFactory::GetForProfile(profile);
39 service->RestoreMostRecentEntry(nullptr); 43 service->RestoreMostRecentEntry(nullptr);
40 } 44 }
41 45
42 } // namespace 46 } // namespace
43 47
44 ChromeNewWindowClient::ChromeNewWindowClient() {} 48 ChromeNewWindowClient::ChromeNewWindowClient() : binding_(this) {
49 service_manager::Connector* connector =
50 content::ServiceManagerConnection::GetForProcess()->GetConnector();
51 connector->ConnectToInterface(ash_util::GetAshServiceName(),
52 &new_window_controller_);
53
54 // Register this object as the client interface implementation.
55 ash::mojom::NewWindowClientAssociatedPtrInfo ptr_info;
56 binding_.Bind(&ptr_info, new_window_controller_.associated_group());
57 new_window_controller_->SetClient(std::move(ptr_info));
58 }
59
45 ChromeNewWindowClient::~ChromeNewWindowClient() {} 60 ChromeNewWindowClient::~ChromeNewWindowClient() {}
46 61
47 // TabRestoreHelper is used to restore a tab. In particular when the user 62 // TabRestoreHelper is used to restore a tab. In particular when the user
48 // attempts to a restore a tab if the TabRestoreService hasn't finished loading 63 // attempts to a restore a tab if the TabRestoreService hasn't finished loading
49 // this waits for it. Once the TabRestoreService finishes loading the tab is 64 // this waits for it. Once the TabRestoreService finishes loading the tab is
50 // restored. 65 // restored.
51 class ChromeNewWindowClient::TabRestoreHelper 66 class ChromeNewWindowClient::TabRestoreHelper
52 : public sessions::TabRestoreServiceObserver { 67 : public sessions::TabRestoreServiceObserver {
53 public: 68 public:
54 TabRestoreHelper(ChromeNewWindowClient* delegate, 69 TabRestoreHelper(ChromeNewWindowClient* delegate,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 GURL(url)); 201 GURL(url));
187 } 202 }
188 203
189 void ChromeNewWindowClient::ShowTaskManager() { 204 void ChromeNewWindowClient::ShowTaskManager() {
190 chrome::OpenTaskManager(NULL); 205 chrome::OpenTaskManager(NULL);
191 } 206 }
192 207
193 void ChromeNewWindowClient::OpenFeedbackPage() { 208 void ChromeNewWindowClient::OpenFeedbackPage() {
194 chrome::OpenFeedbackDialog(BrowserList::GetInstance()->GetLastActive()); 209 chrome::OpenFeedbackDialog(BrowserList::GetInstance()->GetLastActive());
195 } 210 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_new_window_client.h ('k') | chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698