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

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

Issue 181233007: kiosk: Fix network check skipped regression. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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/startup_app_launcher.h" 5 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/signin/signin_manager_factory.h" 25 #include "chrome/browser/signin/signin_manager_factory.h"
26 #include "chrome/browser/ui/extensions/application_launch.h" 26 #include "chrome/browser/ui/extensions/application_launch.h"
27 #include "chrome/common/chrome_paths.h" 27 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/chrome_version_info.h" 29 #include "chrome/common/chrome_version_info.h"
30 #include "chrome/common/extensions/manifest_url_handler.h" 30 #include "chrome/common/extensions/manifest_url_handler.h"
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/notification_service.h" 32 #include "content/public/browser/notification_service.h"
33 #include "extensions/browser/extension_system.h" 33 #include "extensions/browser/extension_system.h"
34 #include "extensions/common/extension.h" 34 #include "extensions/common/extension.h"
35 #include "extensions/common/manifest_constants.h"
35 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" 36 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
36 #include "extensions/common/manifest_handlers/offline_enabled_info.h" 37 #include "extensions/common/manifest_handlers/offline_enabled_info.h"
37 #include "google_apis/gaia/gaia_auth_consumer.h" 38 #include "google_apis/gaia/gaia_auth_consumer.h"
38 #include "google_apis/gaia/gaia_constants.h" 39 #include "google_apis/gaia/gaia_constants.h"
39 #include "net/base/load_flags.h" 40 #include "net/base/load_flags.h"
40 #include "net/url_request/url_fetcher.h" 41 #include "net/url_request/url_fetcher.h"
41 #include "net/url_request/url_fetcher_delegate.h" 42 #include "net/url_request/url_fetcher_delegate.h"
42 #include "net/url_request/url_request_context_getter.h" 43 #include "net/url_request/url_request_context_getter.h"
43 #include "net/url_request/url_request_status.h" 44 #include "net/url_request/url_request_status.h"
44 #include "url/gurl.h" 45 #include "url/gurl.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 142 }
142 143
143 // If we are restarting chrome (i.e. on crash), we need to initialize 144 // If we are restarting chrome (i.e. on crash), we need to initialize
144 // OAuth2TokenService as well. 145 // OAuth2TokenService as well.
145 InitializeTokenService(); 146 InitializeTokenService();
146 } 147 }
147 148
148 void StartupAppLauncher::MaybeInitializeNetwork() { 149 void StartupAppLauncher::MaybeInitializeNetwork() {
149 const Extension* extension = extensions::ExtensionSystem::Get(profile_)-> 150 const Extension* extension = extensions::ExtensionSystem::Get(profile_)->
150 extension_service()->GetInstalledExtension(app_id_); 151 extension_service()->GetInstalledExtension(app_id_);
152 // Kiosk apps are platform apps and platform apps default to be
153 // offline enabled if "offline_enabled" key is not provided. However,
154 // network check should be performed in that case. The only case the check
155 // should be skipped is the kiosk app explicitly declares "offline_enabled"
156 // true in its manifest.
miket_OOO 2014/03/05 18:32:22 Is this a good idea? It's giving a lot of subtlety
xiyuan 2014/03/05 18:44:18 Agree that having a new key would be more straight
151 const bool requires_network = !extension || 157 const bool requires_network = !extension ||
158 !extension->manifest()->HasKey(
159 extensions::manifest_keys::kOfflineEnabled) ||
152 !extensions::OfflineEnabledInfo::IsOfflineEnabled(extension); 160 !extensions::OfflineEnabledInfo::IsOfflineEnabled(extension);
153 161
154 if (requires_network) { 162 if (requires_network) {
155 delegate_->InitializeNetwork(); 163 delegate_->InitializeNetwork();
156 return; 164 return;
157 } 165 }
158 166
159 // Offline enabled app attempts update if network is ready. Otherwise, 167 // Offline enabled app attempts update if network is ready. Otherwise,
160 // go directly to launch. 168 // go directly to launch.
161 if (delegate_->IsNetworkReady()) 169 if (delegate_->IsNetworkReady())
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 ready_to_launch_ = true; 317 ready_to_launch_ = true;
310 delegate_->OnReadyToLaunch(); 318 delegate_->OnReadyToLaunch();
311 } 319 }
312 320
313 void StartupAppLauncher::UpdateAppData() { 321 void StartupAppLauncher::UpdateAppData() {
314 KioskAppManager::Get()->ClearAppData(app_id_); 322 KioskAppManager::Get()->ClearAppData(app_id_);
315 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); 323 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL);
316 } 324 }
317 325
318 } // namespace chromeos 326 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/kiosk_browsertest.cc » ('j') | chrome/browser/chromeos/login/kiosk_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698