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