Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / apps / chrome_app_window_client_views_cocoa.mm
blob5185df5d294c832f1cfa19c956eac0e03cd83a08
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/apps/chrome_app_window_client.h"
7 #include "base/command_line.h"
8 #import "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h"
9 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.h"
10 #include "chrome/common/chrome_switches.h"
12 namespace {
14 bool UseMacViewsNativeAppWindows() {
15   const base::CommandLine* command_line =
16       base::CommandLine::ForCurrentProcess();
17   if (command_line->HasSwitch(switches::kEnableMacViewsNativeAppWindows))
18     return true;
19   if (command_line->HasSwitch(switches::kDisableMacViewsNativeAppWindows))
20     return false;
21   return false;  // Current default.
24 }  // namespace
26 // static
27 extensions::NativeAppWindow* ChromeAppWindowClient::CreateNativeAppWindowImpl(
28     extensions::AppWindow* app_window,
29     const extensions::AppWindow::CreateParams& params) {
30   if (UseMacViewsNativeAppWindows()) {
31     ChromeNativeAppWindowViewsMac* window = new ChromeNativeAppWindowViewsMac;
32     window->Init(app_window, params);
33     return window;
34   }
36   return new NativeAppWindowCocoa(app_window, params);