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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc

Issue 166903006: Move *ShellWindowLauncher* to *AppWindowLauncher* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 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/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 20 matching lines...) Expand all
31 #include "chrome/browser/extensions/extension_util.h" 31 #include "chrome/browser/extensions/extension_util.h"
32 #include "chrome/browser/extensions/launch_util.h" 32 #include "chrome/browser/extensions/launch_util.h"
33 #include "chrome/browser/favicon/favicon_tab_helper.h" 33 #include "chrome/browser/favicon/favicon_tab_helper.h"
34 #include "chrome/browser/prefs/incognito_mode_prefs.h" 34 #include "chrome/browser/prefs/incognito_mode_prefs.h"
35 #include "chrome/browser/prefs/pref_service_syncable.h" 35 #include "chrome/browser/prefs/pref_service_syncable.h"
36 #include "chrome/browser/profiles/profile.h" 36 #include "chrome/browser/profiles/profile.h"
37 #include "chrome/browser/profiles/profile_manager.h" 37 #include "chrome/browser/profiles/profile_manager.h"
38 #include "chrome/browser/ui/ash/app_sync_ui_state.h" 38 #include "chrome/browser/ui/ash/app_sync_ui_state.h"
39 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" 39 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
40 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h " 40 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h "
41 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
42 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h"
41 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll er.h" 43 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll er.h"
42 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" 44 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
43 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" 45 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h"
44 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h " 46 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h "
45 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h" 47 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h"
46 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" 48 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
47 #include "chrome/browser/ui/ash/launcher/launcher_app_tab_helper.h" 49 #include "chrome/browser/ui/ash/launcher/launcher_app_tab_helper.h"
48 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" 50 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
49 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_controller.h"
50 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h "
51 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 51 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
52 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 52 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
53 #include "chrome/browser/ui/browser.h" 53 #include "chrome/browser/ui/browser.h"
54 #include "chrome/browser/ui/browser_commands.h" 54 #include "chrome/browser/ui/browser_commands.h"
55 #include "chrome/browser/ui/browser_finder.h" 55 #include "chrome/browser/ui/browser_finder.h"
56 #include "chrome/browser/ui/browser_list.h" 56 #include "chrome/browser/ui/browser_list.h"
57 #include "chrome/browser/ui/browser_tabstrip.h" 57 #include "chrome/browser/ui/browser_tabstrip.h"
58 #include "chrome/browser/ui/browser_window.h" 58 #include "chrome/browser/ui/browser_window.h"
59 #include "chrome/browser/ui/extensions/application_launch.h" 59 #include "chrome/browser/ui/extensions/application_launch.h"
60 #include "chrome/browser/ui/extensions/extension_enable_flow.h" 60 #include "chrome/browser/ui/extensions/extension_enable_flow.h"
(...skipping 21 matching lines...) Expand all
82 #include "net/base/url_util.h" 82 #include "net/base/url_util.h"
83 #include "ui/aura/root_window.h" 83 #include "ui/aura/root_window.h"
84 #include "ui/aura/window.h" 84 #include "ui/aura/window.h"
85 #include "ui/base/l10n/l10n_util.h" 85 #include "ui/base/l10n/l10n_util.h"
86 #include "ui/views/corewm/window_animations.h" 86 #include "ui/views/corewm/window_animations.h"
87 87
88 #if defined(OS_CHROMEOS) 88 #if defined(OS_CHROMEOS)
89 #include "chrome/browser/browser_process.h" 89 #include "chrome/browser/browser_process.h"
90 #include "chrome/browser/chromeos/login/user_manager.h" 90 #include "chrome/browser/chromeos/login/user_manager.h"
91 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" 91 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
92 #include "chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_contr oller.h"
92 #include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h" 93 #include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h"
93 #include "chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_con troller.h"
94 #endif 94 #endif
95 95
96 using extensions::Extension; 96 using extensions::Extension;
97 using extensions::UnloadedExtensionInfo; 97 using extensions::UnloadedExtensionInfo;
98 using extension_misc::kGmailAppId; 98 using extension_misc::kGmailAppId;
99 using content::WebContents; 99 using content::WebContents;
100 100
101 // static 101 // static
102 ChromeLauncherController* ChromeLauncherController::instance_ = NULL; 102 ChromeLauncherController* ChromeLauncherController::instance_ = NULL;
103 103
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 349 }
350 350
351 // Create our v1/v2 application / browser monitors which will inform the 351 // Create our v1/v2 application / browser monitors which will inform the
352 // launcher of status changes. 352 // launcher of status changes.
353 if (chrome::MultiUserWindowManager::GetMultiProfileMode() == 353 if (chrome::MultiUserWindowManager::GetMultiProfileMode() ==
354 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) { 354 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) {
355 // If running in separated destkop mode, we create the multi profile version 355 // If running in separated destkop mode, we create the multi profile version
356 // of status monitor. 356 // of status monitor.
357 browser_status_monitor_.reset(new MultiProfileBrowserStatusMonitor(this)); 357 browser_status_monitor_.reset(new MultiProfileBrowserStatusMonitor(this));
358 shell_window_controller_.reset( 358 shell_window_controller_.reset(
359 new MultiProfileShellWindowLauncherController(this)); 359 new MultiProfileAppWindowLauncherController(this));
360 } else { 360 } else {
361 // Create our v1/v2 application / browser monitors which will inform the 361 // Create our v1/v2 application / browser monitors which will inform the
362 // launcher of status changes. 362 // launcher of status changes.
363 browser_status_monitor_.reset(new BrowserStatusMonitor(this)); 363 browser_status_monitor_.reset(new BrowserStatusMonitor(this));
364 shell_window_controller_.reset(new ShellWindowLauncherController(this)); 364 shell_window_controller_.reset(new AppWindowLauncherController(this));
365 } 365 }
366 #else 366 #else
367 // Create our v1/v2 application / browser monitors which will inform the 367 // Create our v1/v2 application / browser monitors which will inform the
368 // launcher of status changes. 368 // launcher of status changes.
369 browser_status_monitor_.reset(new BrowserStatusMonitor(this)); 369 browser_status_monitor_.reset(new BrowserStatusMonitor(this));
370 shell_window_controller_.reset(new ShellWindowLauncherController(this)); 370 shell_window_controller_.reset(new AppWindowLauncherController(this));
371 #endif 371 #endif
372 372
373 // Right now ash::Shell isn't created for tests. 373 // Right now ash::Shell isn't created for tests.
374 // TODO(mukai): Allows it to observe display change and write tests. 374 // TODO(mukai): Allows it to observe display change and write tests.
375 if (ash::Shell::HasInstance()) { 375 if (ash::Shell::HasInstance()) {
376 ash::Shell::GetInstance()->display_controller()->AddObserver(this); 376 ash::Shell::GetInstance()->display_controller()->AddObserver(this);
377 item_delegate_manager_ = 377 item_delegate_manager_ =
378 ash::Shell::GetInstance()->shelf_item_delegate_manager(); 378 ash::Shell::GetInstance()->shelf_item_delegate_manager();
379 } 379 }
380 380
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 } 1279 }
1280 return std::vector<content::WebContents*>(); 1280 return std::vector<content::WebContents*>();
1281 } 1281 }
1282 1282
1283 void ChromeLauncherController::ActivateShellApp(const std::string& app_id, 1283 void ChromeLauncherController::ActivateShellApp(const std::string& app_id,
1284 int index) { 1284 int index) {
1285 ash::ShelfID id = GetShelfIDForAppID(app_id); 1285 ash::ShelfID id = GetShelfIDForAppID(app_id);
1286 if (id) { 1286 if (id) {
1287 LauncherItemController* controller = id_to_item_controller_map_[id]; 1287 LauncherItemController* controller = id_to_item_controller_map_[id];
1288 if (controller->type() == LauncherItemController::TYPE_APP) { 1288 if (controller->type() == LauncherItemController::TYPE_APP) {
1289 ShellWindowLauncherItemController* shell_window_controller = 1289 AppWindowLauncherItemController* app_window_controller =
1290 static_cast<ShellWindowLauncherItemController*>(controller); 1290 static_cast<AppWindowLauncherItemController*>(controller);
1291 shell_window_controller->ActivateIndexedApp(index); 1291 app_window_controller->ActivateIndexedApp(index);
1292 } 1292 }
1293 } 1293 }
1294 } 1294 }
1295 1295
1296 bool ChromeLauncherController::IsWebContentHandledByApplication( 1296 bool ChromeLauncherController::IsWebContentHandledByApplication(
1297 content::WebContents* web_contents, 1297 content::WebContents* web_contents,
1298 const std::string& app_id) { 1298 const std::string& app_id) {
1299 if ((web_contents_to_app_id_.find(web_contents) != 1299 if ((web_contents_to_app_id_.find(web_contents) !=
1300 web_contents_to_app_id_.end()) && 1300 web_contents_to_app_id_.end()) &&
1301 (web_contents_to_app_id_[web_contents] == app_id)) 1301 (web_contents_to_app_id_[web_contents] == app_id))
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 } 2058 }
2059 2059
2060 void ChromeLauncherController::ReleaseProfile() { 2060 void ChromeLauncherController::ReleaseProfile() {
2061 if (app_sync_ui_state_) 2061 if (app_sync_ui_state_)
2062 app_sync_ui_state_->RemoveObserver(this); 2062 app_sync_ui_state_->RemoveObserver(this);
2063 2063
2064 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); 2064 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this);
2065 2065
2066 pref_change_registrar_.RemoveAll(); 2066 pref_change_registrar_.RemoveAll();
2067 } 2067 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698