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

Side by Side Diff: chrome/browser/chromeos/app_mode/app_launch_utils.cc

Issue 827293003: Update {virtual,override,final} to follow C++11 style in chrome/browser/chromeos/app_mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comment Created 5 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/app_mode/app_session_lifetime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/app_mode/app_launch_utils.h" 5 #include "chrome/browser/chromeos/app_mode/app_launch_utils.h"
6 6
7 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" 7 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
8 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" 8 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h"
9 #include "chrome/browser/lifetime/application_lifetime.h" 9 #include "chrome/browser/lifetime/application_lifetime.h"
10 10
11 namespace chromeos { 11 namespace chromeos {
12 12
13 // A simple manager for the app launch that starts the launch 13 // A simple manager for the app launch that starts the launch
14 // and deletes itself when the launch finishes. On launch failure, 14 // and deletes itself when the launch finishes. On launch failure,
15 // it exits the browser process. 15 // it exits the browser process.
16 class AppLaunchManager : public StartupAppLauncher::Delegate { 16 class AppLaunchManager : public StartupAppLauncher::Delegate {
17 public: 17 public:
18 AppLaunchManager(Profile* profile, const std::string& app_id) 18 AppLaunchManager(Profile* profile, const std::string& app_id)
19 : startup_app_launcher_( 19 : startup_app_launcher_(
20 new StartupAppLauncher(profile, 20 new StartupAppLauncher(profile,
21 app_id, 21 app_id,
22 false /* diagnostic_mode */, 22 false /* diagnostic_mode */,
23 this)) {} 23 this)) {}
24 24
25 void Start() { 25 void Start() {
26 startup_app_launcher_->Initialize(); 26 startup_app_launcher_->Initialize();
27 } 27 }
28 28
29 private: 29 private:
30 virtual ~AppLaunchManager() {} 30 ~AppLaunchManager() override {}
31 31
32 void Cleanup() { delete this; } 32 void Cleanup() { delete this; }
33 33
34 // StartupAppLauncher::Delegate overrides: 34 // StartupAppLauncher::Delegate overrides:
35 virtual void InitializeNetwork() override { 35 void InitializeNetwork() override {
36 // This is on crash-restart path and assumes network is online. 36 // This is on crash-restart path and assumes network is online.
37 // TODO(xiyuan): Remove the crash-restart path for kiosk or add proper 37 // TODO(xiyuan): Remove the crash-restart path for kiosk or add proper
38 // network configure handling. 38 // network configure handling.
39 startup_app_launcher_->ContinueWithNetworkReady(); 39 startup_app_launcher_->ContinueWithNetworkReady();
40 } 40 }
41 virtual bool IsNetworkReady() override { 41 bool IsNetworkReady() override {
42 // See comments above. Network is assumed to be online here. 42 // See comments above. Network is assumed to be online here.
43 return true; 43 return true;
44 } 44 }
45 virtual void OnLoadingOAuthFile() override {} 45 void OnLoadingOAuthFile() override {}
46 virtual void OnInitializingTokenService() override {} 46 void OnInitializingTokenService() override {}
47 virtual void OnInstallingApp() override {} 47 void OnInstallingApp() override {}
48 virtual void OnReadyToLaunch() override { 48 void OnReadyToLaunch() override { startup_app_launcher_->LaunchApp(); }
49 startup_app_launcher_->LaunchApp(); 49 void OnLaunchSucceeded() override { Cleanup(); }
50 } 50 void OnLaunchFailed(KioskAppLaunchError::Error error) override {
51 virtual void OnLaunchSucceeded() override { Cleanup(); }
52 virtual void OnLaunchFailed(KioskAppLaunchError::Error error) override {
53 KioskAppLaunchError::Save(error); 51 KioskAppLaunchError::Save(error);
54 chrome::AttemptUserExit(); 52 chrome::AttemptUserExit();
55 Cleanup(); 53 Cleanup();
56 } 54 }
57 virtual bool IsShowingNetworkConfigScreen() override { return false; } 55 bool IsShowingNetworkConfigScreen() override { return false; }
58 56
59 scoped_ptr<StartupAppLauncher> startup_app_launcher_; 57 scoped_ptr<StartupAppLauncher> startup_app_launcher_;
60 58
61 DISALLOW_COPY_AND_ASSIGN(AppLaunchManager); 59 DISALLOW_COPY_AND_ASSIGN(AppLaunchManager);
62 }; 60 };
63 61
64 void LaunchAppOrDie(Profile* profile, const std::string& app_id) { 62 void LaunchAppOrDie(Profile* profile, const std::string& app_id) {
65 // AppLaunchManager manages its own lifetime. 63 // AppLaunchManager manages its own lifetime.
66 (new AppLaunchManager(profile, app_id))->Start(); 64 (new AppLaunchManager(profile, app_id))->Start();
67 } 65 }
68 66
69 } // namespace chromeos 67 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/app_mode/app_session_lifetime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698