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

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

Issue 115113006: Rename Launcher to Shelf. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 7 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 | 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"
11 #include "ash/launcher/launcher.h"
12 #include "ash/multi_profile_uma.h" 11 #include "ash/multi_profile_uma.h"
13 #include "ash/root_window_controller.h" 12 #include "ash/root_window_controller.h"
13 #include "ash/shelf/shelf.h"
14 #include "ash/shelf/shelf_item_delegate_manager.h" 14 #include "ash/shelf/shelf_item_delegate_manager.h"
15 #include "ash/shelf/shelf_layout_manager.h" 15 #include "ash/shelf/shelf_layout_manager.h"
16 #include "ash/shelf/shelf_model.h" 16 #include "ash/shelf/shelf_model.h"
17 #include "ash/shelf/shelf_widget.h" 17 #include "ash/shelf/shelf_widget.h"
18 #include "ash/shell.h" 18 #include "ash/shell.h"
19 #include "ash/wm/window_util.h" 19 #include "ash/wm/window_util.h"
20 #include "base/command_line.h" 20 #include "base/command_line.h"
21 #include "base/prefs/scoped_user_pref_update.h" 21 #include "base/prefs/scoped_user_pref_update.h"
22 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 content::Source<Profile>(profile_)); 395 content::Source<Profile>(profile_));
396 } 396 }
397 397
398 ChromeLauncherController::~ChromeLauncherController() { 398 ChromeLauncherController::~ChromeLauncherController() {
399 // Reset the BrowserStatusMonitor as it has a weak pointer to this. 399 // Reset the BrowserStatusMonitor as it has a weak pointer to this.
400 browser_status_monitor_.reset(); 400 browser_status_monitor_.reset();
401 401
402 // Reset the shell window controller here since it has a weak pointer to this. 402 // Reset the shell window controller here since it has a weak pointer to this.
403 shell_window_controller_.reset(); 403 shell_window_controller_.reset();
404 404
405 for (std::set<ash::Launcher*>::iterator iter = launchers_.begin(); 405 for (std::set<ash::Shelf*>::iterator iter = shelves_.begin();
406 iter != launchers_.end(); 406 iter != shelves_.end();
407 ++iter) 407 ++iter)
408 (*iter)->shelf_widget()->shelf_layout_manager()->RemoveObserver(this); 408 (*iter)->shelf_widget()->shelf_layout_manager()->RemoveObserver(this);
409 409
410 model_->RemoveObserver(this); 410 model_->RemoveObserver(this);
411 if (ash::Shell::HasInstance()) 411 if (ash::Shell::HasInstance())
412 ash::Shell::GetInstance()->display_controller()->RemoveObserver(this); 412 ash::Shell::GetInstance()->display_controller()->RemoveObserver(this);
413 for (IDToItemControllerMap::iterator i = id_to_item_controller_map_.begin(); 413 for (IDToItemControllerMap::iterator i = id_to_item_controller_map_.begin();
414 i != id_to_item_controller_map_.end(); ++i) { 414 i != id_to_item_controller_map_.end(); ++i) {
415 int index = model_->ItemIndexByID(i->first); 415 int index = model_->ItemIndexByID(i->first);
416 // A "browser proxy" is not known to the model and this removal does 416 // A "browser proxy" is not known to the model and this removal does
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 views::corewm::WINDOW_ANIMATION_TYPE_BOUNCE); 1096 views::corewm::WINDOW_ANIMATION_TYPE_BOUNCE);
1097 } else { 1097 } else {
1098 window->Minimize(); 1098 window->Minimize();
1099 } 1099 }
1100 } else { 1100 } else {
1101 window->Show(); 1101 window->Show();
1102 window->Activate(); 1102 window->Activate();
1103 } 1103 }
1104 } 1104 }
1105 1105
1106 void ChromeLauncherController::OnLauncherCreated(ash::Launcher* launcher) { 1106 void ChromeLauncherController::OnShelfCreated(ash::Shelf* shelf) {
1107 launchers_.insert(launcher); 1107 shelves_.insert(shelf);
1108 launcher->shelf_widget()->shelf_layout_manager()->AddObserver(this); 1108 shelf->shelf_widget()->shelf_layout_manager()->AddObserver(this);
1109 } 1109 }
1110 1110
1111 void ChromeLauncherController::OnLauncherDestroyed(ash::Launcher* launcher) { 1111 void ChromeLauncherController::OnShelfDestroyed(ash::Shelf* shelf) {
1112 launchers_.erase(launcher); 1112 shelves_.erase(shelf);
1113 // RemoveObserver is not called here, since by the time this method is called 1113 // RemoveObserver is not called here, since by the time this method is called
1114 // Launcher is already in its destructor. 1114 // Shelf is already in its destructor.
1115 } 1115 }
1116 1116
1117 void ChromeLauncherController::ShelfItemAdded(int index) { 1117 void ChromeLauncherController::ShelfItemAdded(int index) {
1118 // The app list launcher can get added to the shelf after we applied the 1118 // The app list launcher can get added to the shelf after we applied the
1119 // preferences. In that case the item might be at the wrong spot. As such we 1119 // preferences. In that case the item might be at the wrong spot. As such we
1120 // call the function again. 1120 // call the function again.
1121 if (model_->items()[index].type == ash::TYPE_APP_LIST && 1121 if (model_->items()[index].type == ash::TYPE_APP_LIST &&
1122 ash::switches::UseAlternateShelfLayout()) 1122 ash::switches::UseAlternateShelfLayout())
1123 UpdateAppLaunchersFromPref(); 1123 UpdateAppLaunchersFromPref();
1124 } 1124 }
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
2015 } 2015 }
2016 2016
2017 void ChromeLauncherController::ReleaseProfile() { 2017 void ChromeLauncherController::ReleaseProfile() {
2018 if (app_sync_ui_state_) 2018 if (app_sync_ui_state_)
2019 app_sync_ui_state_->RemoveObserver(this); 2019 app_sync_ui_state_->RemoveObserver(this);
2020 2020
2021 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); 2021 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this);
2022 2022
2023 pref_change_registrar_.RemoveAll(); 2023 pref_change_registrar_.RemoveAll();
2024 } 2024 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698