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

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

Issue 14063018: Implemented argument wrapping for CallJS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix. Created 7 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/eula_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/values.h"
10 #include "chrome/browser/chromeos/login/help_app_launcher.h" 9 #include "chrome/browser/chromeos/login/help_app_launcher.h"
11 #include "chrome/browser/chromeos/login/webui_login_display.h" 10 #include "chrome/browser/chromeos/login/webui_login_display.h"
12 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 11 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
13 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
14 #include "grit/browser_resources.h" 13 #include "grit/browser_resources.h"
15 #include "grit/chromium_strings.h" 14 #include "grit/chromium_strings.h"
16 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
17 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
18 17
19 namespace chromeos { 18 namespace chromeos {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 dict->SetString("rlzEnabled", "enabled"); 75 dict->SetString("rlzEnabled", "enabled");
77 #else 76 #else
78 dict->SetString("rlzEnabled", "disabled"); 77 dict->SetString("rlzEnabled", "disabled");
79 #endif 78 #endif
80 } 79 }
81 80
82 void EulaScreenHandler::Initialize() { 81 void EulaScreenHandler::Initialize() {
83 if (!page_is_ready() || !delegate_) 82 if (!page_is_ready() || !delegate_)
84 return; 83 return;
85 84
86 base::FundamentalValue checked(delegate_->IsUsageStatsEnabled()); 85 CallJS("cr.ui.Oobe.setUsageStats", delegate_->IsUsageStatsEnabled());
87 CallJS("cr.ui.Oobe.setUsageStats", checked);
88 86
89 // This OEM EULA is a file:// URL which we're unable to load in iframe. 87 // This OEM EULA is a file:// URL which we're unable to load in iframe.
90 // Instead if it's defined we use chrome://terms/oem that will load same file. 88 // Instead if it's defined we use chrome://terms/oem that will load same file.
91 if (!delegate_->GetOemEulaUrl().is_empty()) { 89 if (!delegate_->GetOemEulaUrl().is_empty()) {
92 StringValue oem_eula_url(chrome::kChromeUITermsOemURL); 90 CallJS("cr.ui.Oobe.setOemEulaUrl",
93 CallJS("cr.ui.Oobe.setOemEulaUrl", oem_eula_url); 91 std::string(chrome::kChromeUITermsOemURL));
94 } 92 }
95 93
96 if (show_on_init_) { 94 if (show_on_init_) {
97 Show(); 95 Show();
98 show_on_init_ = false; 96 show_on_init_ = false;
99 } 97 }
100 } 98 }
101 99
102 void EulaScreenHandler::RegisterMessages() { 100 void EulaScreenHandler::RegisterMessages() {
103 AddCallback("eulaOnExit", &EulaScreenHandler::HandleOnExit); 101 AddCallback("eulaOnExit", &EulaScreenHandler::HandleOnExit);
104 AddCallback("eulaOnLearnMore", &EulaScreenHandler::HandleOnLearnMore); 102 AddCallback("eulaOnLearnMore", &EulaScreenHandler::HandleOnLearnMore);
105 AddCallback("eulaOnInstallationSettingsPopupOpened", 103 AddCallback("eulaOnInstallationSettingsPopupOpened",
106 &EulaScreenHandler::HandleOnInstallationSettingsPopupOpened); 104 &EulaScreenHandler::HandleOnInstallationSettingsPopupOpened);
107 } 105 }
108 106
109 void EulaScreenHandler::OnPasswordFetched(const std::string& tpm_password) { 107 void EulaScreenHandler::OnPasswordFetched(const std::string& tpm_password) {
110 StringValue tpm_password_value(tpm_password); 108 CallJS("cr.ui.Oobe.setTpmPassword", tpm_password);
111 CallJS("cr.ui.Oobe.setTpmPassword", tpm_password_value);
112 } 109 }
113 110
114 void EulaScreenHandler::HandleOnExit(bool accepted, bool usage_stats_enabled) { 111 void EulaScreenHandler::HandleOnExit(bool accepted, bool usage_stats_enabled) {
115 if (delegate_) 112 if (delegate_)
116 delegate_->OnExit(accepted, usage_stats_enabled); 113 delegate_->OnExit(accepted, usage_stats_enabled);
117 } 114 }
118 115
119 void EulaScreenHandler::HandleOnLearnMore() { 116 void EulaScreenHandler::HandleOnLearnMore() {
120 if (!help_app_.get()) 117 if (!help_app_.get())
121 help_app_ = new HelpAppLauncher(GetNativeWindow()); 118 help_app_ = new HelpAppLauncher(GetNativeWindow());
122 help_app_->ShowHelpTopic(HelpAppLauncher::HELP_STATS_USAGE); 119 help_app_->ShowHelpTopic(HelpAppLauncher::HELP_STATS_USAGE);
123 } 120 }
124 121
125 void EulaScreenHandler::HandleOnInstallationSettingsPopupOpened() { 122 void EulaScreenHandler::HandleOnInstallationSettingsPopupOpened() {
126 if (delegate_) 123 if (delegate_)
127 delegate_->InitiatePasswordFetch(); 124 delegate_->InitiatePasswordFetch();
128 } 125 }
129 126
130 } // namespace chromeos 127 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698