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

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

Issue 7774009: [cros] check for updates in WebUI OOBE can be cancelled in dev builds. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed mock for UpdateScreenActor. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/update_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "grit/chromium_strings.h" 9 #include "grit/chromium_strings.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 void UpdateScreenHandler::GetLocalizedStrings( 28 void UpdateScreenHandler::GetLocalizedStrings(
29 DictionaryValue *localized_strings) { 29 DictionaryValue *localized_strings) {
30 localized_strings->SetString("updateScreenTitle", 30 localized_strings->SetString("updateScreenTitle",
31 l10n_util::GetStringUTF16(IDS_UPDATE_SCREEN_TITLE)); 31 l10n_util::GetStringUTF16(IDS_UPDATE_SCREEN_TITLE));
32 localized_strings->SetString("checkingForUpdates", 32 localized_strings->SetString("checkingForUpdates",
33 l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES)); 33 l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES));
34 localized_strings->SetString("installingUpdateDesc", 34 localized_strings->SetString("installingUpdateDesc",
35 l10n_util::GetStringUTF16(IDS_INSTALLING_UPDATE_DESC)); 35 l10n_util::GetStringUTF16(IDS_INSTALLING_UPDATE_DESC));
36 #if !defined(OFFICIAL_BUILD)
37 localized_strings->SetString("cancelUpdateHint",
38 l10n_util::GetStringUTF16(IDS_UPDATE_CANCEL));
39 localized_strings->SetString("cancelledUpdateMessage",
40 l10n_util::GetStringUTF16(IDS_UPDATE_CANCELLED));
41 #endif
36 } 42 }
37 43
38 void UpdateScreenHandler::Initialize() { 44 void UpdateScreenHandler::Initialize() {
39 if (show_on_init_) { 45 if (show_on_init_) {
40 Show(); 46 Show();
41 show_on_init_ = false; 47 show_on_init_ = false;
42 } 48 }
43 } 49 }
44 50
51 void UpdateScreenHandler::SetDelegate(UpdateScreenActor::Delegate* screen) {
52 screen_ = screen;
53 }
54
45 void UpdateScreenHandler::Show() { 55 void UpdateScreenHandler::Show() {
46 if (!page_is_ready()) { 56 if (!page_is_ready()) {
47 show_on_init_ = true; 57 show_on_init_ = true;
48 return; 58 return;
49 } 59 }
50 ShowScreen(kUpdateScreen, NULL); 60 ShowScreen(kUpdateScreen, NULL);
61 #if !defined(OFFICIAL_BUILD)
62 web_ui_->CallJavascriptFunction("oobe.UpdateScreen.enableUpdateCancel");
63 #endif
51 } 64 }
52 65
53 void UpdateScreenHandler::Hide() { 66 void UpdateScreenHandler::Hide() {
54 } 67 }
55 68
56 void UpdateScreenHandler::PrepareToShow() { 69 void UpdateScreenHandler::PrepareToShow() {
57 } 70 }
58 71
59 void UpdateScreenHandler::ShowManualRebootInfo() { 72 void UpdateScreenHandler::ShowManualRebootInfo() {
60 StringValue message(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED)); 73 StringValue message(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED));
(...skipping 19 matching lines...) Expand all
80 } else { 93 } else {
81 info_message.reset(Value::CreateStringValue( 94 info_message.reset(Value::CreateStringValue(
82 l10n_util::GetStringFUTF16(IDS_INSTALLING_UPDATE, 95 l10n_util::GetStringFUTF16(IDS_INSTALLING_UPDATE,
83 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)))); 96 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))));
84 } 97 }
85 web_ui_->CallJavascriptFunction("cr.ui.Oobe.setUpdateMessage", 98 web_ui_->CallJavascriptFunction("cr.ui.Oobe.setUpdateMessage",
86 *info_message); 99 *info_message);
87 } 100 }
88 101
89 void UpdateScreenHandler::RegisterMessages() { 102 void UpdateScreenHandler::RegisterMessages() {
103 #if !defined(OFFICIAL_BUILD)
104 web_ui_->RegisterMessageCallback(
105 "cancelUpdate",
106 NewCallback(this, &UpdateScreenHandler::HandleUpdateCancel));
107 #endif
90 } 108 }
91 109
110 #if !defined(OFFICIAL_BUILD)
111 void UpdateScreenHandler::HandleUpdateCancel(const base::ListValue* args) {
112 DCHECK(args && args->empty());
113 screen_->CancelUpdate();
114 }
115 #endif
116
92 } // namespace chromeos 117 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698