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

Side by Side Diff: chrome/browser/ui/apps/chrome_app_window_client.cc

Issue 2934513003: Changes in app.window and app.runtime to support lock screen note taking (Closed)
Patch Set: . Created 3 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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/apps/chrome_app_window_client.h" 5 #include "chrome/browser/ui/apps/chrome_app_window_client.h"
6 6
7 #include <memory>
8
9 #include "base/memory/ptr_util.h"
7 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
8 #include "build/build_config.h" 11 #include "build/build_config.h"
9 #include "chrome/browser/devtools/devtools_window.h" 12 #include "chrome/browser/devtools/devtools_window.h"
10 #include "components/version_info/version_info.h" 13 #include "components/version_info/version_info.h"
11 #include "content/public/browser/devtools_agent_host.h" 14 #include "content/public/browser/devtools_agent_host.h"
12 #include "extensions/browser/app_window/app_window.h" 15 #include "extensions/browser/app_window/app_window.h"
13 #include "extensions/common/extension.h" 16 #include "extensions/common/extension.h"
14 #include "extensions/common/features/feature_channel.h" 17 #include "extensions/common/features/feature_channel.h"
15 18
19 #if defined(OS_CHROMEOS)
20 #include "chrome/browser/chromeos/lock_screen_apps/state_controller.h"
21 #endif
22
16 // TODO(jamescook): We probably shouldn't compile this class at all on Android. 23 // TODO(jamescook): We probably shouldn't compile this class at all on Android.
17 // See http://crbug.com/343612 24 // See http://crbug.com/343612
18 #if !defined(OS_ANDROID) 25 #if !defined(OS_ANDROID)
19 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 26 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
20 #endif 27 #endif
21 28
22 ChromeAppWindowClient::ChromeAppWindowClient() { 29 ChromeAppWindowClient::ChromeAppWindowClient() {
23 } 30 }
24 31
25 ChromeAppWindowClient::~ChromeAppWindowClient() { 32 ChromeAppWindowClient::~ChromeAppWindowClient() {
(...skipping 10 matching lines...) Expand all
36 content::BrowserContext* context, 43 content::BrowserContext* context,
37 const extensions::Extension* extension) { 44 const extensions::Extension* extension) {
38 #if defined(OS_ANDROID) 45 #if defined(OS_ANDROID)
39 return NULL; 46 return NULL;
40 #else 47 #else
41 return new extensions::AppWindow(context, new ChromeAppDelegate(true), 48 return new extensions::AppWindow(context, new ChromeAppDelegate(true),
42 extension); 49 extension);
43 #endif 50 #endif
44 } 51 }
45 52
53 extensions::AppWindow*
54 ChromeAppWindowClient::CreateAppWindowForLockScreenAction(
55 content::BrowserContext* context,
56 const extensions::Extension* extension,
57 extensions::api::app_runtime::ActionType action) {
58 #if defined(OS_CHROMEOS)
59 if (!lock_screen_apps::StateController::IsEnabled())
60 return nullptr;
61
62 return lock_screen_apps::StateController::Get()
63 ->CreateAppWindowForLockScreenAction(
64 context, extension, action,
65 base::MakeUnique<ChromeAppDelegate>(true /* keep_alive */));
66 #else
67 return nullptr;
68 #endif
69 }
70
46 extensions::NativeAppWindow* ChromeAppWindowClient::CreateNativeAppWindow( 71 extensions::NativeAppWindow* ChromeAppWindowClient::CreateNativeAppWindow(
47 extensions::AppWindow* window, 72 extensions::AppWindow* window,
48 extensions::AppWindow::CreateParams* params) { 73 extensions::AppWindow::CreateParams* params) {
49 #if defined(OS_ANDROID) 74 #if defined(OS_ANDROID)
50 return NULL; 75 return nullptr;
51 #else 76 #else
52 return CreateNativeAppWindowImpl(window, *params); 77 return CreateNativeAppWindowImpl(window, *params);
53 #endif 78 #endif
54 } 79 }
55 80
56 void ChromeAppWindowClient::OpenDevToolsWindow( 81 void ChromeAppWindowClient::OpenDevToolsWindow(
57 content::WebContents* web_contents, 82 content::WebContents* web_contents,
58 const base::Closure& callback) { 83 const base::Closure& callback) {
59 scoped_refptr<content::DevToolsAgentHost> agent( 84 scoped_refptr<content::DevToolsAgentHost> agent(
60 content::DevToolsAgentHost::GetOrCreateFor(web_contents)); 85 content::DevToolsAgentHost::GetOrCreateFor(web_contents));
61 DevToolsWindow::OpenDevToolsWindow(web_contents); 86 DevToolsWindow::OpenDevToolsWindow(web_contents);
62 87
63 DevToolsWindow* devtools_window = 88 DevToolsWindow* devtools_window =
64 DevToolsWindow::FindDevToolsWindow(agent.get()); 89 DevToolsWindow::FindDevToolsWindow(agent.get());
65 if (devtools_window) 90 if (devtools_window)
66 devtools_window->SetLoadCompletedCallback(callback); 91 devtools_window->SetLoadCompletedCallback(callback);
67 else 92 else
68 callback.Run(); 93 callback.Run();
69 } 94 }
70 95
71 bool ChromeAppWindowClient::IsCurrentChannelOlderThanDev() { 96 bool ChromeAppWindowClient::IsCurrentChannelOlderThanDev() {
72 return extensions::GetCurrentChannel() > version_info::Channel::DEV; 97 return extensions::GetCurrentChannel() > version_info::Channel::DEV;
73 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698