Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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. |
|
Mr4D (OOO till 08-26)
2013/08/16 22:43:22
Close...
The "ChromeLauncherControllerPerApp" will
simonhong_
2013/08/19 05:26:11
Done.
| |
| 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 "ash/ash_switches.h" | |
| 8 #include "base/command_line.h" | |
| 9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h" | 7 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h" |
| 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser. h" | |
| 11 | 8 |
| 12 // statics | 9 // statics |
| 13 ChromeLauncherController* ChromeLauncherController::instance_ = NULL; | 10 ChromeLauncherController* ChromeLauncherController::instance_ = NULL; |
| 14 | 11 |
| 15 // static | 12 // static |
| 16 ChromeLauncherController* ChromeLauncherController::CreateInstance( | 13 ChromeLauncherController* ChromeLauncherController::CreateInstance( |
| 17 Profile* profile, | 14 Profile* profile, |
| 18 ash::LauncherModel* model) { | 15 ash::LauncherModel* model) { |
| 19 // We do not check here for re-creation of the ChromeLauncherController since | 16 // We do not check here for re-creation of the ChromeLauncherController since |
| 20 // it appears that it might be intentional that the ChromeLauncherController | 17 // it appears that it might be intentional that the ChromeLauncherController |
| 21 // can be re-created. | 18 // can be re-created. |
| 22 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 19 instance_ = new ChromeLauncherControllerPerApp(profile, model); |
| 23 ash::switches::kAshDisablePerAppLauncher)) | |
| 24 instance_ = new ChromeLauncherControllerPerApp(profile, model); | |
| 25 else | |
| 26 instance_ = new ChromeLauncherControllerPerBrowser(profile, model); | |
| 27 return instance_; | 20 return instance_; |
| 28 } | 21 } |
| 29 | 22 |
| 30 ChromeLauncherController::~ChromeLauncherController() { | 23 ChromeLauncherController::~ChromeLauncherController() { |
| 31 if (instance_ == this) | 24 if (instance_ == this) |
| 32 instance_ = NULL; | 25 instance_ = NULL; |
| 33 } | 26 } |
| 34 | |
| 35 bool ChromeLauncherController::IsPerAppLauncher() { | |
| 36 if (!instance_) | |
| 37 return false; | |
| 38 return instance_->GetPerAppInterface() != NULL; | |
| 39 } | |
| OLD | NEW |