OLD | NEW |
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/chromeos/login/background_view.h" | 5 #include "chrome/browser/chromeos/login/background_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/chromeos/login/wizard_controller.h" | 21 #include "chrome/browser/chromeos/login/wizard_controller.h" |
22 #include "chrome/browser/chromeos/status/clock_menu_button.h" | 22 #include "chrome/browser/chromeos/status/clock_menu_button.h" |
23 #include "chrome/browser/chromeos/status/input_method_menu_button.h" | 23 #include "chrome/browser/chromeos/status/input_method_menu_button.h" |
24 #include "chrome/browser/chromeos/status/network_menu_button.h" | 24 #include "chrome/browser/chromeos/status/network_menu_button.h" |
25 #include "chrome/browser/chromeos/status/status_area_view.h" | 25 #include "chrome/browser/chromeos/status/status_area_view.h" |
26 #include "chrome/browser/chromeos/wm_ipc.h" | 26 #include "chrome/browser/chromeos/wm_ipc.h" |
27 #include "chrome/browser/policy/browser_policy_connector.h" | 27 #include "chrome/browser/policy/browser_policy_connector.h" |
28 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
29 #include "chrome/browser/ui/views/dom_view.h" | 29 #include "chrome/browser/ui/views/dom_view.h" |
30 #include "chrome/browser/ui/views/window.h" | 30 #include "chrome/browser/ui/views/window.h" |
31 #include "chrome/common/chrome_version_info.h" | |
32 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
33 #include "grit/chromium_strings.h" | 32 #include "grit/chromium_strings.h" |
34 #include "grit/generated_resources.h" | 33 #include "grit/generated_resources.h" |
35 #include "grit/theme_resources.h" | 34 #include "grit/theme_resources.h" |
36 #include "third_party/cros/chromeos_wm_ipc_enums.h" | 35 #include "third_party/cros/chromeos_wm_ipc_enums.h" |
37 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
38 #include "ui/base/resource/resource_bundle.h" | 37 #include "ui/base/resource/resource_bundle.h" |
39 #include "ui/base/x/x11_util.h" | 38 #include "ui/base/x/x11_util.h" |
40 #include "ui/gfx/gtk_util.h" | 39 #include "ui/gfx/gtk_util.h" |
41 #include "views/controls/button/text_button.h" | 40 #include "views/controls/button/text_button.h" |
42 #include "views/controls/label.h" | 41 #include "views/controls/label.h" |
43 #include "views/screen.h" | 42 #include "views/screen.h" |
44 #include "views/window/window.h" | 43 #include "views/window/window.h" |
45 | 44 |
46 using views::Widget; | 45 using views::Widget; |
47 | 46 |
48 namespace { | 47 namespace { |
49 | 48 |
50 const SkColor kVersionColor = 0xff5c739f; | 49 const SkColor kVersionColor = 0xff5c739f; |
51 const char kPlatformLabel[] = "cros:"; | |
52 | 50 |
53 // Returns the corresponding step id for step constant. | 51 // Returns the corresponding step id for step constant. |
54 int GetStepId(size_t step) { | 52 int GetStepId(size_t step) { |
55 switch (step) { | 53 switch (step) { |
56 case chromeos::BackgroundView::SELECT_NETWORK: | 54 case chromeos::BackgroundView::SELECT_NETWORK: |
57 return IDS_OOBE_SELECT_NETWORK; | 55 return IDS_OOBE_SELECT_NETWORK; |
58 case chromeos::BackgroundView::EULA: | 56 case chromeos::BackgroundView::EULA: |
59 return IDS_OOBE_EULA; | 57 return IDS_OOBE_EULA; |
60 case chromeos::BackgroundView::SIGNIN: | 58 case chromeos::BackgroundView::SIGNIN: |
61 return IDS_OOBE_SIGNIN; | 59 return IDS_OOBE_SIGNIN; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 boot_times_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 332 boot_times_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
335 boot_times_label_->SetColor(kVersionColor); | 333 boot_times_label_->SetColor(kVersionColor); |
336 boot_times_label_->SetFont(rb.GetFont(ResourceBundle::SmallFont)); | 334 boot_times_label_->SetFont(rb.GetFont(ResourceBundle::SmallFont)); |
337 if (idx < 0) | 335 if (idx < 0) |
338 AddChildView(boot_times_label_); | 336 AddChildView(boot_times_label_); |
339 else | 337 else |
340 AddChildViewAt(boot_times_label_, idx); | 338 AddChildViewAt(boot_times_label_, idx); |
341 } | 339 } |
342 | 340 |
343 if (CrosLibrary::Get()->EnsureLoaded()) { | 341 if (CrosLibrary::Get()->EnsureLoaded()) { |
344 version_loader_.EnablePlatformVersions(true); | |
345 version_loader_.GetVersion( | 342 version_loader_.GetVersion( |
346 &version_consumer_, | 343 &version_consumer_, |
347 NewCallback(this, &BackgroundView::OnVersion), | 344 NewCallback(this, &BackgroundView::OnVersion), |
348 is_official_build_ ? | 345 is_official_build_? |
349 VersionLoader::VERSION_SHORT_WITH_DATE : | 346 VersionLoader::VERSION_SHORT_WITH_DATE : |
350 VersionLoader::VERSION_FULL); | 347 VersionLoader::VERSION_FULL); |
351 if (!is_official_build_) { | 348 if (!is_official_build_) { |
352 boot_times_loader_.GetBootTimes( | 349 boot_times_loader_.GetBootTimes( |
353 &boot_times_consumer_, | 350 &boot_times_consumer_, |
354 NewCallback(this, &BackgroundView::OnBootTimes)); | 351 NewCallback(this, &BackgroundView::OnBootTimes)); |
355 } | 352 } |
356 } else { | 353 } else { |
357 UpdateVersionLabel(); | 354 UpdateVersionLabel(); |
358 } | 355 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 void BackgroundView::UpdateVersionLabel() { | 398 void BackgroundView::UpdateVersionLabel() { |
402 if (!CrosLibrary::Get()->EnsureLoaded()) { | 399 if (!CrosLibrary::Get()->EnsureLoaded()) { |
403 os_version_label_->SetText( | 400 os_version_label_->SetText( |
404 ASCIIToWide(CrosLibrary::Get()->load_error_string())); | 401 ASCIIToWide(CrosLibrary::Get()->load_error_string())); |
405 return; | 402 return; |
406 } | 403 } |
407 | 404 |
408 if (version_text_.empty()) | 405 if (version_text_.empty()) |
409 return; | 406 return; |
410 | 407 |
411 chrome::VersionInfo version_info; | 408 // TODO(jungshik): Is string concatenation OK here? |
412 std::string label_text = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); | 409 std::string label_text = l10n_util::GetStringUTF8(IDS_PRODUCT_OS_NAME); |
413 label_text += ' '; | 410 label_text += ' '; |
414 label_text += version_info.Version(); | 411 label_text += l10n_util::GetStringUTF8(IDS_VERSION_FIELD_PREFIX); |
415 label_text += " ("; | |
416 // TODO(rkc): Fix this. This needs to be in a resource file, but we have had | |
417 // to put it in for merge into R12. Also, look at rtl implications for this | |
418 // entire string composition code. | |
419 label_text += kPlatformLabel; | |
420 label_text += ' '; | 412 label_text += ' '; |
421 label_text += version_text_; | 413 label_text += version_text_; |
422 label_text += ')'; | |
423 | 414 |
424 if (!enterprise_domain_text_.empty()) { | 415 if (!enterprise_domain_text_.empty()) { |
425 label_text += ' '; | 416 label_text += ' '; |
426 if (enterprise_status_text_.empty()) { | 417 if (enterprise_status_text_.empty()) { |
427 label_text += l10n_util::GetStringFUTF8( | 418 label_text += l10n_util::GetStringFUTF8( |
428 IDS_LOGIN_MANAGED_BY_LABEL_FORMAT, | 419 IDS_LOGIN_MANAGED_BY_LABEL_FORMAT, |
429 UTF8ToUTF16(enterprise_domain_text_)); | 420 UTF8ToUTF16(enterprise_domain_text_)); |
430 } else { | 421 } else { |
431 label_text += l10n_util::GetStringFUTF8( | 422 label_text += l10n_util::GetStringFUTF8( |
432 IDS_LOGIN_MANAGED_BY_WITH_STATUS_LABEL_FORMAT, | 423 IDS_LOGIN_MANAGED_BY_WITH_STATUS_LABEL_FORMAT, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 boot_times_label_->SetText(ASCIIToWide(boot_times_text)); | 510 boot_times_label_->SetText(ASCIIToWide(boot_times_text)); |
520 } | 511 } |
521 | 512 |
522 void BackgroundView::OnPolicyStateChanged( | 513 void BackgroundView::OnPolicyStateChanged( |
523 policy::CloudPolicySubsystem::PolicySubsystemState state, | 514 policy::CloudPolicySubsystem::PolicySubsystemState state, |
524 policy::CloudPolicySubsystem::ErrorDetails error_details) { | 515 policy::CloudPolicySubsystem::ErrorDetails error_details) { |
525 UpdateEnterpriseInfo(); | 516 UpdateEnterpriseInfo(); |
526 } | 517 } |
527 | 518 |
528 } // namespace chromeos | 519 } // namespace chromeos |
OLD | NEW |