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

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

Issue 557833007: Remove Increment/DecrementKeepAliveCount from AppsClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass ScopedKeepAlive Created 6 years, 3 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 "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "chrome/browser/apps/scoped_keep_alive.h"
8 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/devtools/devtools_window.h" 10 #include "chrome/browser/devtools/devtools_window.h"
10 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/common/extensions/features/feature_channel.h" 12 #include "chrome/common/extensions/features/feature_channel.h"
12 #include "extensions/browser/app_window/app_window.h" 13 #include "extensions/browser/app_window/app_window.h"
13 #include "extensions/common/extension.h" 14 #include "extensions/common/extension.h"
14 15
15 // TODO(jamescook): We probably shouldn't compile this class at all on Android. 16 // TODO(jamescook): We probably shouldn't compile this class at all on Android.
16 // See http://crbug.com/343612 17 // See http://crbug.com/343612
17 #if !defined(OS_ANDROID) 18 #if !defined(OS_ANDROID)
18 #include "chrome/browser/lifetime/application_lifetime.h"
19 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 19 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
20 #endif 20 #endif
21 21
22 ChromeAppWindowClient::ChromeAppWindowClient() { 22 ChromeAppWindowClient::ChromeAppWindowClient() {
23 } 23 }
24 24
25 ChromeAppWindowClient::~ChromeAppWindowClient() { 25 ChromeAppWindowClient::~ChromeAppWindowClient() {
26 } 26 }
27 27
28 // static 28 // static
29 ChromeAppWindowClient* ChromeAppWindowClient::GetInstance() { 29 ChromeAppWindowClient* ChromeAppWindowClient::GetInstance() {
30 return Singleton<ChromeAppWindowClient, 30 return Singleton<ChromeAppWindowClient,
31 LeakySingletonTraits<ChromeAppWindowClient> >::get(); 31 LeakySingletonTraits<ChromeAppWindowClient> >::get();
32 } 32 }
33 33
34 std::vector<content::BrowserContext*> 34 std::vector<content::BrowserContext*>
35 ChromeAppWindowClient::GetLoadedBrowserContexts() { 35 ChromeAppWindowClient::GetLoadedBrowserContexts() {
36 std::vector<Profile*> profiles = 36 std::vector<Profile*> profiles =
37 g_browser_process->profile_manager()->GetLoadedProfiles(); 37 g_browser_process->profile_manager()->GetLoadedProfiles();
38 return std::vector<content::BrowserContext*>(profiles.begin(), 38 return std::vector<content::BrowserContext*>(profiles.begin(),
39 profiles.end()); 39 profiles.end());
40 } 40 }
41 41
42 extensions::AppWindow* ChromeAppWindowClient::CreateAppWindow( 42 extensions::AppWindow* ChromeAppWindowClient::CreateAppWindow(
43 content::BrowserContext* context, 43 content::BrowserContext* context,
44 const extensions::Extension* extension) { 44 const extensions::Extension* extension) {
45 #if defined(OS_ANDROID) 45 #if defined(OS_ANDROID)
46 return NULL; 46 return NULL;
47 #else 47 #else
48 return new extensions::AppWindow(context, new ChromeAppDelegate, extension); 48 return new extensions::AppWindow(
49 context, new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)),
tapted 2014/09/24 07:12:41 nit: 1 arg per line
hashimoto 2014/09/24 09:03:46 Done.
50 extension);
49 #endif 51 #endif
50 } 52 }
51 53
52 extensions::NativeAppWindow* ChromeAppWindowClient::CreateNativeAppWindow( 54 extensions::NativeAppWindow* ChromeAppWindowClient::CreateNativeAppWindow(
53 extensions::AppWindow* window, 55 extensions::AppWindow* window,
54 const extensions::AppWindow::CreateParams& params) { 56 const extensions::AppWindow::CreateParams& params) {
55 #if defined(OS_ANDROID) 57 #if defined(OS_ANDROID)
56 return NULL; 58 return NULL;
57 #else 59 #else
58 return CreateNativeAppWindowImpl(window, params); 60 return CreateNativeAppWindowImpl(window, params);
59 #endif 61 #endif
60 } 62 }
61 63
62 void ChromeAppWindowClient::IncrementKeepAliveCount() {
63 #if !defined(OS_ANDROID)
64 chrome::IncrementKeepAliveCount();
65 #endif
66 }
67
68 void ChromeAppWindowClient::DecrementKeepAliveCount() {
69 #if !defined(OS_ANDROID)
70 chrome::DecrementKeepAliveCount();
71 #endif
72 }
73
74 void ChromeAppWindowClient::OpenDevToolsWindow( 64 void ChromeAppWindowClient::OpenDevToolsWindow(
75 content::WebContents* web_contents, 65 content::WebContents* web_contents,
76 const base::Closure& callback) { 66 const base::Closure& callback) {
77 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( 67 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow(
78 web_contents, DevToolsToggleAction::ShowConsole()); 68 web_contents, DevToolsToggleAction::ShowConsole());
79 devtools_window->SetLoadCompletedCallback(callback); 69 devtools_window->SetLoadCompletedCallback(callback);
80 } 70 }
81 71
82 bool ChromeAppWindowClient::IsCurrentChannelOlderThanDev() { 72 bool ChromeAppWindowClient::IsCurrentChannelOlderThanDev() {
83 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; 73 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV;
84 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698