OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/login/eula_view.h" | 5 #include "chrome/browser/chromeos/login/eula_view.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/chromeos/customization_document.h" | 16 #include "chrome/browser/chromeos/customization_document.h" |
17 #include "chrome/browser/chromeos/login/network_screen_delegate.h" | 17 #include "chrome/browser/chromeos/login/network_screen_delegate.h" |
18 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 18 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
19 #include "chrome/browser/chromeos/login/wizard_controller.h" | 19 #include "chrome/browser/chromeos/login/wizard_controller.h" |
20 #include "chrome/browser/options_util.h" | |
21 #include "chrome/browser/pref_service.h" | |
20 #include "chrome/browser/profile_manager.h" | 22 #include "chrome/browser/profile_manager.h" |
21 #include "chrome/browser/renderer_host/site_instance.h" | 23 #include "chrome/browser/renderer_host/site_instance.h" |
22 #include "chrome/browser/tab_contents/tab_contents.h" | 24 #include "chrome/browser/tab_contents/tab_contents.h" |
23 #include "chrome/browser/views/dom_view.h" | 25 #include "chrome/browser/views/dom_view.h" |
24 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
25 #include "chrome/installer/util/google_update_settings.h" | 27 #include "chrome/installer/util/google_update_settings.h" |
26 #include "grit/chromium_strings.h" | 28 #include "grit/chromium_strings.h" |
27 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
28 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
29 #include "views/controls/button/checkbox.h" | 31 #include "views/controls/button/checkbox.h" |
30 #include "views/controls/button/native_button.h" | 32 #include "views/controls/button/native_button.h" |
31 #include "views/controls/label.h" | 33 #include "views/controls/label.h" |
32 #include "views/grid_layout.h" | 34 #include "views/grid_layout.h" |
33 #include "views/layout_manager.h" | 35 #include "views/layout_manager.h" |
34 #include "views/standard_layout.h" | 36 #include "views/standard_layout.h" |
35 | 37 |
38 #if defined(USE_LINUX_BREAKPAD) | |
39 #include "chrome/app/breakpad_linux.h" | |
40 #endif | |
41 | |
36 namespace { | 42 namespace { |
37 | 43 |
38 const int kBorderSize = 10; | 44 const int kBorderSize = 10; |
39 const int kMargin = 20; | 45 const int kMargin = 20; |
40 const int kLastButtonHorizontalMargin = 10; | 46 const int kLastButtonHorizontalMargin = 10; |
41 const int kCheckBowWidth = 22; | 47 const int kCheckBowWidth = 22; |
42 const int kTextMargin = 10; | 48 const int kTextMargin = 10; |
43 | 49 |
44 // TODO(glotov): this URL should be changed to actual Google ChromeOS EULA. | 50 // TODO(glotov): this URL should be changed to actual Google ChromeOS EULA. |
45 // See crbug.com/4647 | 51 // See crbug.com/4647 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 layout->AddView(box_view); | 180 layout->AddView(box_view); |
175 | 181 |
176 google_eula_view_ = new DOMView(); | 182 google_eula_view_ = new DOMView(); |
177 box_view->AddChildView(google_eula_view_); | 183 box_view->AddChildView(google_eula_view_); |
178 | 184 |
179 layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing); | 185 layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing); |
180 layout->StartRow(0, SINGLE_CONTROL_WITH_SHIFT_ROW); | 186 layout->StartRow(0, SINGLE_CONTROL_WITH_SHIFT_ROW); |
181 usage_statistics_checkbox_ = new views::Checkbox(); | 187 usage_statistics_checkbox_ = new views::Checkbox(); |
182 usage_statistics_checkbox_->SetMultiLine(true); | 188 usage_statistics_checkbox_->SetMultiLine(true); |
183 usage_statistics_checkbox_->SetChecked( | 189 usage_statistics_checkbox_->SetChecked( |
184 GoogleUpdateSettings::GetCollectStatsConsent()); | 190 g_browser_process->local_state()->GetBoolean( |
191 prefs::kMetricsReportingEnabled)); | |
185 layout->AddView(usage_statistics_checkbox_); | 192 layout->AddView(usage_statistics_checkbox_); |
186 | 193 |
187 layout->StartRow(0, SINGLE_LINK_WITH_SHIFT_ROW); | 194 layout->StartRow(0, SINGLE_LINK_WITH_SHIFT_ROW); |
188 learn_more_link_ = new views::Link(); | 195 learn_more_link_ = new views::Link(); |
189 learn_more_link_->SetController(this); | 196 learn_more_link_->SetController(this); |
190 layout->AddView(learn_more_link_); | 197 layout->AddView(learn_more_link_); |
191 | 198 |
192 layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing); | 199 layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing); |
193 layout->StartRow(0, SINGLE_CONTROL_ROW); | 200 layout->StartRow(0, SINGLE_CONTROL_ROW); |
194 oem_eula_label_ = new views::Label(std::wstring(), label_font); | 201 oem_eula_label_ = new views::Label(std::wstring(), label_font); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 UpdateLocalizedStrings(); | 270 UpdateLocalizedStrings(); |
264 Layout(); | 271 Layout(); |
265 } | 272 } |
266 | 273 |
267 //////////////////////////////////////////////////////////////////////////////// | 274 //////////////////////////////////////////////////////////////////////////////// |
268 // views::ButtonListener implementation: | 275 // views::ButtonListener implementation: |
269 | 276 |
270 void EulaView::ButtonPressed(views::Button* sender, const views::Event& event) { | 277 void EulaView::ButtonPressed(views::Button* sender, const views::Event& event) { |
271 if (sender == continue_button_) { | 278 if (sender == continue_button_) { |
272 if (usage_statistics_checkbox_) { | 279 if (usage_statistics_checkbox_) { |
273 GoogleUpdateSettings::SetCollectStatsConsent( | 280 const bool enable_reporting = usage_statistics_checkbox_->checked(); |
274 usage_statistics_checkbox_->checked()); | 281 PrefService* prefs = g_browser_process->local_state(); |
282 if (prefs->GetBoolean(prefs::kMetricsReportingEnabled) != | |
283 enable_reporting) { | |
284 prefs->SetBoolean(prefs::kMetricsReportingEnabled, enable_reporting); | |
Mattias Nissler (ping if slow)
2010/08/05 07:57:12
I'm not current on the plans for ChromeOS w.r.t. c
| |
285 prefs->SavePersistentPrefs(); | |
286 OptionsUtil::ResolveMetricsReportingEnabled(enable_reporting); | |
287 #if defined(USE_LINUX_BREAKPAD) | |
288 if (enable_reporting) | |
289 InitCrashReporter(); | |
290 #endif | |
291 } | |
275 } | 292 } |
276 observer_->OnExit(ScreenObserver::EULA_ACCEPTED); | 293 observer_->OnExit(ScreenObserver::EULA_ACCEPTED); |
277 } | 294 } |
278 // TODO(glotov): handle cancel button. | 295 // TODO(glotov): handle cancel button. |
279 } | 296 } |
280 | 297 |
281 //////////////////////////////////////////////////////////////////////////////// | 298 //////////////////////////////////////////////////////////////////////////////// |
282 // views::LinkController implementation: | 299 // views::LinkController implementation: |
283 | 300 |
284 void EulaView::LinkActivated(views::Link* source, int event_flags) { | 301 void EulaView::LinkActivated(views::Link* source, int event_flags) { |
(...skipping 19 matching lines...) Expand all Loading... | |
304 unsigned changed_flags) { | 321 unsigned changed_flags) { |
305 if (changed_flags & TabContents::INVALIDATE_TITLE) { | 322 if (changed_flags & TabContents::INVALIDATE_TITLE) { |
306 if (PublishTitleIfReady(contents, google_eula_view_, google_eula_label_) || | 323 if (PublishTitleIfReady(contents, google_eula_view_, google_eula_label_) || |
307 PublishTitleIfReady(contents, oem_eula_view_, oem_eula_label_)) { | 324 PublishTitleIfReady(contents, oem_eula_view_, oem_eula_label_)) { |
308 Layout(); | 325 Layout(); |
309 } | 326 } |
310 } | 327 } |
311 } | 328 } |
312 | 329 |
313 } // namespace chromeos | 330 } // namespace chromeos |
OLD | NEW |