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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc

Issue 386633003: kiosk: Retry failed app data fetch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor tweak to use URLFetcher default behavior rather than set 0 retry Created 6 years, 5 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/ui/webui/chromeos/login/kiosk_app_menu_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 19 matching lines...) Expand all
30 const char kKioskSetAppsOldAPI[] = "login.AppsMenuButton.setApps"; 30 const char kKioskSetAppsOldAPI[] = "login.AppsMenuButton.setApps";
31 const char kKioskShowErrorNewAPI[] = "login.AccountPickerScreen.showAppError"; 31 const char kKioskShowErrorNewAPI[] = "login.AccountPickerScreen.showAppError";
32 const char kKioskShowErrorOldAPI[] = "login.AppsMenuButton.showError"; 32 const char kKioskShowErrorOldAPI[] = "login.AppsMenuButton.showError";
33 33
34 // Default app icon size. 34 // Default app icon size.
35 const char kDefaultAppIconSizeString[] = "96px"; 35 const char kDefaultAppIconSizeString[] = "96px";
36 const int kMaxAppIconSize = 160; 36 const int kMaxAppIconSize = 160;
37 37
38 } // namespace 38 } // namespace
39 39
40 KioskAppMenuHandler::KioskAppMenuHandler() 40 KioskAppMenuHandler::KioskAppMenuHandler(
41 const scoped_refptr<NetworkStateInformer>& network_state_informer)
41 : weak_ptr_factory_(this), 42 : weak_ptr_factory_(this),
42 is_webui_initialized_(false) { 43 is_webui_initialized_(false),
44 network_state_informer_(network_state_informer) {
43 KioskAppManager::Get()->AddObserver(this); 45 KioskAppManager::Get()->AddObserver(this);
46 network_state_informer_->AddObserver(this);
44 } 47 }
45 48
46 KioskAppMenuHandler::~KioskAppMenuHandler() { 49 KioskAppMenuHandler::~KioskAppMenuHandler() {
47 KioskAppManager::Get()->RemoveObserver(this); 50 KioskAppManager::Get()->RemoveObserver(this);
51 network_state_informer_->RemoveObserver(this);
48 } 52 }
49 53
50 void KioskAppMenuHandler::GetLocalizedStrings( 54 void KioskAppMenuHandler::GetLocalizedStrings(
51 base::DictionaryValue* localized_strings) { 55 base::DictionaryValue* localized_strings) {
52 localized_strings->SetString( 56 localized_strings->SetString(
53 "showApps", 57 "showApps",
54 l10n_util::GetStringUTF16(IDS_KIOSK_APPS_BUTTON)); 58 l10n_util::GetStringUTF16(IDS_KIOSK_APPS_BUTTON));
55 localized_strings->SetString( 59 localized_strings->SetString(
56 "confirmKioskAppDiagnosticModeFormat", 60 "confirmKioskAppDiagnosticModeFormat",
57 l10n_util::GetStringUTF16(IDS_LOGIN_CONFIRM_KIOSK_DIAGNOSTIC_FORMAT)); 61 l10n_util::GetStringUTF16(IDS_LOGIN_CONFIRM_KIOSK_DIAGNOSTIC_FORMAT));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 130
127 web_ui()->CallJavascriptFunction(EnableNewKioskUI() ? 131 web_ui()->CallJavascriptFunction(EnableNewKioskUI() ?
128 kKioskSetAppsNewAPI : kKioskSetAppsOldAPI, 132 kKioskSetAppsNewAPI : kKioskSetAppsOldAPI,
129 apps_list); 133 apps_list);
130 } 134 }
131 135
132 void KioskAppMenuHandler::HandleInitializeKioskApps( 136 void KioskAppMenuHandler::HandleInitializeKioskApps(
133 const base::ListValue* args) { 137 const base::ListValue* args) {
134 is_webui_initialized_ = true; 138 is_webui_initialized_ = true;
135 SendKioskApps(); 139 SendKioskApps();
140 UpdateState(ErrorScreenActor::ERROR_REASON_UPDATE);
136 } 141 }
137 142
138 void KioskAppMenuHandler::HandleKioskAppsLoaded( 143 void KioskAppMenuHandler::HandleKioskAppsLoaded(
139 const base::ListValue* args) { 144 const base::ListValue* args) {
140 content::NotificationService::current()->Notify( 145 content::NotificationService::current()->Notify(
141 chrome::NOTIFICATION_KIOSK_APPS_LOADED, 146 chrome::NOTIFICATION_KIOSK_APPS_LOADED,
142 content::NotificationService::AllSources(), 147 content::NotificationService::AllSources(),
143 content::NotificationService::NoDetails()); 148 content::NotificationService::NoDetails());
144 } 149 }
145 150
(...skipping 12 matching lines...) Expand all
158 } 163 }
159 164
160 void KioskAppMenuHandler::OnKioskAppsSettingsChanged() { 165 void KioskAppMenuHandler::OnKioskAppsSettingsChanged() {
161 SendKioskApps(); 166 SendKioskApps();
162 } 167 }
163 168
164 void KioskAppMenuHandler::OnKioskAppDataChanged(const std::string& app_id) { 169 void KioskAppMenuHandler::OnKioskAppDataChanged(const std::string& app_id) {
165 SendKioskApps(); 170 SendKioskApps();
166 } 171 }
167 172
173 void KioskAppMenuHandler::UpdateState(ErrorScreenActor::ErrorReason reason) {
174 if (network_state_informer_->state() == NetworkStateInformer::ONLINE)
175 KioskAppManager::Get()->RetryFailedAppDataFetch();
176 }
177
168 } // namespace chromeos 178 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h ('k') | chrome/browser/ui/webui/chromeos/login/oobe_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698