summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
blob: 6a7ee2e4c4d40056016ef0295f3c51779558a419 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"

#include "ash/ash_switches.h"
#include "base/command_line.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.h"

// statics
ChromeLauncherController* ChromeLauncherController::instance_ = NULL;

// static
ChromeLauncherController* ChromeLauncherController::CreateInstance(
    Profile* profile,
    ash::LauncherModel* model) {
  // We do not check here for re-creation of the ChromeLauncherController since
  // it appears that it might be intentional that the ChromeLauncherController
  // can be re-created.
  if (CommandLine::ForCurrentProcess()->HasSwitch(
          ash::switches::kAshEnablePerAppLauncher))
    instance_ = new ChromeLauncherControllerPerApp(profile, model);
  else
    instance_ = new ChromeLauncherControllerPerBrowser(profile, model);
  return instance_;
}

ChromeLauncherController::~ChromeLauncherController() {
  if (instance_ == this)
    instance_ = NULL;
}