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/views/exclusive_access_bubble_views.h" | 5 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/macros.h" | 9 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
10 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
11 #include "build/build_config.h" | 13 #include "build/build_config.h" |
12 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" | 16 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
15 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 17 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
16 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" | 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 key_name_label_->SetBackgroundColor(background_color); | 138 key_name_label_->SetBackgroundColor(background_color); |
137 | 139 |
138 key_name_ = new views::View; | 140 key_name_ = new views::View; |
139 views::BoxLayout* key_name_layout = new views::BoxLayout( | 141 views::BoxLayout* key_name_layout = new views::BoxLayout( |
140 views::BoxLayout::kHorizontal, kKeyNamePaddingPx, kKeyNamePaddingPx, 0); | 142 views::BoxLayout::kHorizontal, kKeyNamePaddingPx, kKeyNamePaddingPx, 0); |
141 key_name_->SetLayoutManager(key_name_layout); | 143 key_name_->SetLayoutManager(key_name_layout); |
142 key_name_->AddChildView(key_name_label_); | 144 key_name_->AddChildView(key_name_label_); |
143 // The key name has a border around it. | 145 // The key name has a border around it. |
144 scoped_ptr<views::Border> border(views::Border::CreateRoundedRectBorder( | 146 scoped_ptr<views::Border> border(views::Border::CreateRoundedRectBorder( |
145 kKeyNameBorderPx, kKeyNameCornerRadius, foreground_color)); | 147 kKeyNameBorderPx, kKeyNameCornerRadius, foreground_color)); |
146 key_name_->SetBorder(border.Pass()); | 148 key_name_->SetBorder(std::move(border)); |
147 AddChildView(key_name_); | 149 AddChildView(key_name_); |
148 | 150 |
149 after_key_ = new views::Label(base::string16(), font_list); | 151 after_key_ = new views::Label(base::string16(), font_list); |
150 after_key_->SetEnabledColor(foreground_color); | 152 after_key_->SetEnabledColor(foreground_color); |
151 after_key_->SetBackgroundColor(background_color); | 153 after_key_->SetBackgroundColor(background_color); |
152 AddChildView(after_key_); | 154 AddChildView(after_key_); |
153 | 155 |
154 SetText(text); | 156 SetText(text); |
155 } | 157 } |
156 | 158 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 ? kBackgroundColor | 247 ? kBackgroundColor |
246 : theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground); | 248 : theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground); |
247 SkColor foreground_color = | 249 SkColor foreground_color = |
248 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() | 250 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() |
249 ? SK_ColorWHITE | 251 ? SK_ColorWHITE |
250 : theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); | 252 : theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); |
251 | 253 |
252 scoped_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder( | 254 scoped_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder( |
253 views::BubbleBorder::NONE, shadow_type, background_color)); | 255 views::BubbleBorder::NONE, shadow_type, background_color)); |
254 set_background(new views::BubbleBackground(bubble_border.get())); | 256 set_background(new views::BubbleBackground(bubble_border.get())); |
255 SetBorder(bubble_border.Pass()); | 257 SetBorder(std::move(bubble_border)); |
256 SetFocusable(false); | 258 SetFocusable(false); |
257 | 259 |
258 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 260 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
259 ui::ResourceBundle::FontStyle font_style = | 261 ui::ResourceBundle::FontStyle font_style = |
260 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() | 262 ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() |
261 ? ui::ResourceBundle::SmallFont | 263 ? ui::ResourceBundle::SmallFont |
262 : ui::ResourceBundle::MediumFont; | 264 : ui::ResourceBundle::MediumFont; |
263 const gfx::FontList& font_list = rb.GetFontList(font_style); | 265 const gfx::FontList& font_list = rb.GetFontList(font_style); |
264 | 266 |
265 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | 267 if (!ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 const content::NotificationDetails& details) { | 657 const content::NotificationDetails& details) { |
656 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); | 658 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); |
657 UpdateForImmersiveState(); | 659 UpdateForImmersiveState(); |
658 } | 660 } |
659 | 661 |
660 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( | 662 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
661 views::Widget* widget, | 663 views::Widget* widget, |
662 bool visible) { | 664 bool visible) { |
663 UpdateMouseWatcher(); | 665 UpdateMouseWatcher(); |
664 } | 666 } |
OLD | NEW |