OLD | NEW |
---|---|
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" | 9 #include "base/values.h" |
bartfab (slow)
2013/04/18 07:39:31
Nit: No longer used.
ygorshenin1
2013/04/18 07:58:23
Done.
| |
10 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 10 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
11 #include "chrome/browser/chromeos/login/webui_login_display.h" | 11 #include "chrome/browser/chromeos/login/webui_login_display.h" |
12 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 12 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "grit/browser_resources.h" | 14 #include "grit/browser_resources.h" |
15 #include "grit/chromium_strings.h" | 15 #include "grit/chromium_strings.h" |
16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 dict->SetString("rlzEnabled", "enabled"); | 76 dict->SetString("rlzEnabled", "enabled"); |
77 #else | 77 #else |
78 dict->SetString("rlzEnabled", "disabled"); | 78 dict->SetString("rlzEnabled", "disabled"); |
79 #endif | 79 #endif |
80 } | 80 } |
81 | 81 |
82 void EulaScreenHandler::Initialize() { | 82 void EulaScreenHandler::Initialize() { |
83 if (!page_is_ready() || !delegate_) | 83 if (!page_is_ready() || !delegate_) |
84 return; | 84 return; |
85 | 85 |
86 base::FundamentalValue checked(delegate_->IsUsageStatsEnabled()); | 86 CallJS("cr.ui.Oobe.setUsageStats", delegate_->IsUsageStatsEnabled()); |
87 CallJS("cr.ui.Oobe.setUsageStats", checked); | |
88 | 87 |
89 // This OEM EULA is a file:// URL which we're unable to load in iframe. | 88 // 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. | 89 // Instead if it's defined we use chrome://terms/oem that will load same file. |
91 if (!delegate_->GetOemEulaUrl().is_empty()) { | 90 if (!delegate_->GetOemEulaUrl().is_empty()) { |
92 StringValue oem_eula_url(chrome::kChromeUITermsOemURL); | 91 CallJS("cr.ui.Oobe.setOemEulaUrl", |
93 CallJS("cr.ui.Oobe.setOemEulaUrl", oem_eula_url); | 92 std::string(chrome::kChromeUITermsOemURL)); |
94 } | 93 } |
95 | 94 |
96 if (show_on_init_) { | 95 if (show_on_init_) { |
97 Show(); | 96 Show(); |
98 show_on_init_ = false; | 97 show_on_init_ = false; |
99 } | 98 } |
100 } | 99 } |
101 | 100 |
102 void EulaScreenHandler::RegisterMessages() { | 101 void EulaScreenHandler::RegisterMessages() { |
103 AddCallback("eulaOnExit", &EulaScreenHandler::HandleOnExit); | 102 AddCallback("eulaOnExit", &EulaScreenHandler::HandleOnExit); |
104 AddCallback("eulaOnLearnMore", &EulaScreenHandler::HandleOnLearnMore); | 103 AddCallback("eulaOnLearnMore", &EulaScreenHandler::HandleOnLearnMore); |
105 AddCallback("eulaOnInstallationSettingsPopupOpened", | 104 AddCallback("eulaOnInstallationSettingsPopupOpened", |
106 &EulaScreenHandler::HandleOnInstallationSettingsPopupOpened); | 105 &EulaScreenHandler::HandleOnInstallationSettingsPopupOpened); |
107 } | 106 } |
108 | 107 |
109 void EulaScreenHandler::OnPasswordFetched(const std::string& tpm_password) { | 108 void EulaScreenHandler::OnPasswordFetched(const std::string& tpm_password) { |
110 StringValue tpm_password_value(tpm_password); | 109 CallJS("cr.ui.Oobe.setTpmPassword", tpm_password); |
111 CallJS("cr.ui.Oobe.setTpmPassword", tpm_password_value); | |
112 } | 110 } |
113 | 111 |
114 void EulaScreenHandler::HandleOnExit(bool accepted, bool usage_stats_enabled) { | 112 void EulaScreenHandler::HandleOnExit(bool accepted, bool usage_stats_enabled) { |
115 if (delegate_) | 113 if (delegate_) |
116 delegate_->OnExit(accepted, usage_stats_enabled); | 114 delegate_->OnExit(accepted, usage_stats_enabled); |
117 } | 115 } |
118 | 116 |
119 void EulaScreenHandler::HandleOnLearnMore() { | 117 void EulaScreenHandler::HandleOnLearnMore() { |
120 if (!help_app_.get()) | 118 if (!help_app_.get()) |
121 help_app_ = new HelpAppLauncher(GetNativeWindow()); | 119 help_app_ = new HelpAppLauncher(GetNativeWindow()); |
122 help_app_->ShowHelpTopic(HelpAppLauncher::HELP_STATS_USAGE); | 120 help_app_->ShowHelpTopic(HelpAppLauncher::HELP_STATS_USAGE); |
123 } | 121 } |
124 | 122 |
125 void EulaScreenHandler::HandleOnInstallationSettingsPopupOpened() { | 123 void EulaScreenHandler::HandleOnInstallationSettingsPopupOpened() { |
126 if (delegate_) | 124 if (delegate_) |
127 delegate_->InitiatePasswordFetch(); | 125 delegate_->InitiatePasswordFetch(); |
128 } | 126 } |
129 | 127 |
130 } // namespace chromeos | 128 } // namespace chromeos |
OLD | NEW |