| 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 "ash/common/system/chromeos/bluetooth/tray_bluetooth.h" | 5 #include "ash/common/system/chromeos/bluetooth/tray_bluetooth.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" | 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" |
| 10 #include "ash/common/system/tray/hover_highlight_view.h" | 10 #include "ash/common/system/tray/hover_highlight_view.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 scroll_content()->AddChildView(container); | 406 scroll_content()->AddChildView(container); |
| 407 return container; | 407 return container; |
| 408 } | 408 } |
| 409 | 409 |
| 410 void SetupConnectedItemMd(HoverHighlightView* container, | 410 void SetupConnectedItemMd(HoverHighlightView* container, |
| 411 const base::string16& text, | 411 const base::string16& text, |
| 412 const gfx::ImageSkia& image) { | 412 const gfx::ImageSkia& image) { |
| 413 container->AddIconAndLabels( | 413 container->AddIconAndLabels( |
| 414 image, text, l10n_util::GetStringUTF16( | 414 image, text, l10n_util::GetStringUTF16( |
| 415 IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTED)); | 415 IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTED)); |
| 416 TrayPopupItemStyle style(GetNativeTheme(), | 416 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::CAPTION); |
| 417 TrayPopupItemStyle::FontStyle::CAPTION); | |
| 418 style.set_color_style(TrayPopupItemStyle::ColorStyle::CONNECTED); | 417 style.set_color_style(TrayPopupItemStyle::ColorStyle::CONNECTED); |
| 419 style.SetupLabel(container->sub_text_label()); | 418 style.SetupLabel(container->sub_text_label()); |
| 420 } | 419 } |
| 421 | 420 |
| 422 void SetupConnectingItemMd(HoverHighlightView* container, | 421 void SetupConnectingItemMd(HoverHighlightView* container, |
| 423 const base::string16& text, | 422 const base::string16& text, |
| 424 const gfx::ImageSkia& image) { | 423 const gfx::ImageSkia& image) { |
| 425 container->AddIconAndLabels( | 424 container->AddIconAndLabels( |
| 426 image, text, l10n_util::GetStringUTF16( | 425 image, text, l10n_util::GetStringUTF16( |
| 427 IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTING)); | 426 IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTING)); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 views::View* item_container) { | 480 views::View* item_container) { |
| 482 base::string16 display_name; | 481 base::string16 display_name; |
| 483 device::BluetoothDeviceType device_type; | 482 device::BluetoothDeviceType device_type; |
| 484 if (FoundDevice(device_id, paired_not_connected_devices_, &display_name, | 483 if (FoundDevice(device_id, paired_not_connected_devices_, &display_name, |
| 485 &device_type)) { | 484 &device_type)) { |
| 486 item_container->RemoveAllChildViews(true); | 485 item_container->RemoveAllChildViews(true); |
| 487 HoverHighlightView* container = | 486 HoverHighlightView* container = |
| 488 static_cast<HoverHighlightView*>(item_container); | 487 static_cast<HoverHighlightView*>(item_container); |
| 489 if (UseMd()) { | 488 if (UseMd()) { |
| 490 TrayPopupItemStyle style( | 489 TrayPopupItemStyle style( |
| 491 GetNativeTheme(), | |
| 492 TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); | 490 TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); |
| 493 gfx::ImageSkia icon_image = CreateVectorIcon( | 491 gfx::ImageSkia icon_image = CreateVectorIcon( |
| 494 GetBluetoothDeviceIcon(device_type, false), style.GetIconColor()); | 492 GetBluetoothDeviceIcon(device_type, false), style.GetIconColor()); |
| 495 SetupConnectingItemMd(container, display_name, icon_image); | 493 SetupConnectingItemMd(container, display_name, icon_image); |
| 496 } else { | 494 } else { |
| 497 display_name = l10n_util::GetStringFUTF16( | 495 display_name = l10n_util::GetStringFUTF16( |
| 498 IDS_ASH_STATUS_TRAY_BLUETOOTH_CONNECTING, display_name); | 496 IDS_ASH_STATUS_TRAY_BLUETOOTH_CONNECTING, display_name); |
| 499 container->AddCheckableLabel(display_name, true /* highlight */, false); | 497 container->AddCheckableLabel(display_name, true /* highlight */, false); |
| 500 } | 498 } |
| 501 scroll_content()->SizeToPreferredSize(); | 499 scroll_content()->SizeToPreferredSize(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 | 642 |
| 645 views::View* CreateDisabledPanel() { | 643 views::View* CreateDisabledPanel() { |
| 646 views::View* container = new views::View; | 644 views::View* container = new views::View; |
| 647 views::BoxLayout* box_layout = | 645 views::BoxLayout* box_layout = |
| 648 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); | 646 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); |
| 649 box_layout->set_main_axis_alignment( | 647 box_layout->set_main_axis_alignment( |
| 650 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); | 648 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); |
| 651 container->SetLayoutManager(box_layout); | 649 container->SetLayoutManager(box_layout); |
| 652 | 650 |
| 653 TrayPopupItemStyle style( | 651 TrayPopupItemStyle style( |
| 654 GetNativeTheme(), TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); | 652 TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL); |
| 655 style.set_color_style(TrayPopupItemStyle::ColorStyle::DISABLED); | 653 style.set_color_style(TrayPopupItemStyle::ColorStyle::DISABLED); |
| 656 | 654 |
| 657 views::ImageView* image_view = new views::ImageView; | 655 views::ImageView* image_view = new views::ImageView; |
| 658 image_view->SetImage(gfx::CreateVectorIcon(kSystemMenuBluetoothDisabledIcon, | 656 image_view->SetImage(gfx::CreateVectorIcon(kSystemMenuBluetoothDisabledIcon, |
| 659 style.GetIconColor())); | 657 style.GetIconColor())); |
| 660 image_view->SetVerticalAlignment(views::ImageView::TRAILING); | 658 image_view->SetVerticalAlignment(views::ImageView::TRAILING); |
| 661 container->AddChildView(image_view); | 659 container->AddChildView(image_view); |
| 662 | 660 |
| 663 views::Label* label = new views::Label( | 661 views::Label* label = new views::Label( |
| 664 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | 662 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 detailed_->Update(); | 761 detailed_->Update(); |
| 764 } | 762 } |
| 765 | 763 |
| 766 void TrayBluetooth::OnBluetoothDiscoveringChanged() { | 764 void TrayBluetooth::OnBluetoothDiscoveringChanged() { |
| 767 if (!detailed_) | 765 if (!detailed_) |
| 768 return; | 766 return; |
| 769 detailed_->Update(); | 767 detailed_->Update(); |
| 770 } | 768 } |
| 771 | 769 |
| 772 } // namespace ash | 770 } // namespace ash |
| OLD | NEW |