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/fullscreen_exit_bubble_views.h" | 5 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(ButtonView); | 60 DISALLOW_COPY_AND_ASSIGN(ButtonView); |
61 }; | 61 }; |
62 | 62 |
63 ButtonView::ButtonView(views::ButtonListener* listener, | 63 ButtonView::ButtonView(views::ButtonListener* listener, |
64 int between_button_spacing) | 64 int between_button_spacing) |
65 : accept_button_(NULL), | 65 : accept_button_(NULL), |
66 deny_button_(NULL) { | 66 deny_button_(NULL) { |
67 accept_button_ = new views::LabelButton(listener, base::string16()); | 67 accept_button_ = new views::LabelButton(listener, base::string16()); |
68 accept_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); | 68 accept_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); |
69 accept_button_->set_focusable(false); | 69 accept_button_->SetFocusable(false); |
70 AddChildView(accept_button_); | 70 AddChildView(accept_button_); |
71 | 71 |
72 deny_button_ = new views::LabelButton(listener, base::string16()); | 72 deny_button_ = new views::LabelButton(listener, base::string16()); |
73 deny_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); | 73 deny_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); |
74 deny_button_->set_focusable(false); | 74 deny_button_->SetFocusable(false); |
75 AddChildView(deny_button_); | 75 AddChildView(deny_button_); |
76 | 76 |
77 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, | 77 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, |
78 between_button_spacing)); | 78 between_button_spacing)); |
79 } | 79 } |
80 | 80 |
81 ButtonView::~ButtonView() { | 81 ButtonView::~ButtonView() { |
82 } | 82 } |
83 | 83 |
84 gfx::Size ButtonView::GetPreferredSize() { | 84 gfx::Size ButtonView::GetPreferredSize() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 link_(NULL), | 131 link_(NULL), |
132 mouse_lock_exit_instruction_(NULL), | 132 mouse_lock_exit_instruction_(NULL), |
133 message_label_(NULL), | 133 message_label_(NULL), |
134 button_view_(NULL), | 134 button_view_(NULL), |
135 browser_fullscreen_exit_accelerator_(accelerator) { | 135 browser_fullscreen_exit_accelerator_(accelerator) { |
136 views::BubbleBorder* bubble_border = new views::BubbleBorder( | 136 views::BubbleBorder* bubble_border = new views::BubbleBorder( |
137 views::BubbleBorder::NONE, views::BubbleBorder::BIG_SHADOW, | 137 views::BubbleBorder::NONE, views::BubbleBorder::BIG_SHADOW, |
138 SK_ColorWHITE); | 138 SK_ColorWHITE); |
139 set_background(new views::BubbleBackground(bubble_border)); | 139 set_background(new views::BubbleBackground(bubble_border)); |
140 set_border(bubble_border); | 140 set_border(bubble_border); |
141 set_focusable(false); | 141 SetFocusable(false); |
142 | 142 |
143 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 143 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
144 message_label_ = new views::Label(); | 144 message_label_ = new views::Label(); |
145 message_label_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); | 145 message_label_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); |
146 | 146 |
147 mouse_lock_exit_instruction_ = new views::Label(); | 147 mouse_lock_exit_instruction_ = new views::Label(); |
148 mouse_lock_exit_instruction_->set_collapse_when_hidden(true); | 148 mouse_lock_exit_instruction_->set_collapse_when_hidden(true); |
149 mouse_lock_exit_instruction_->SetText(bubble_->GetInstructionText()); | 149 mouse_lock_exit_instruction_->SetText(bubble_->GetInstructionText()); |
150 mouse_lock_exit_instruction_->SetFont( | 150 mouse_lock_exit_instruction_->SetFont( |
151 rb.GetFont(ui::ResourceBundle::MediumFont)); | 151 rb.GetFont(ui::ResourceBundle::MediumFont)); |
152 | 152 |
153 link_ = new views::Link(); | 153 link_ = new views::Link(); |
154 link_->set_collapse_when_hidden(true); | 154 link_->set_collapse_when_hidden(true); |
155 link_->set_focusable(false); | 155 link_->SetFocusable(false); |
156 #if defined(OS_CHROMEOS) | 156 #if defined(OS_CHROMEOS) |
157 // On CrOS, the link text doesn't change, since it doesn't show the shortcut. | 157 // On CrOS, the link text doesn't change, since it doesn't show the shortcut. |
158 link_->SetText(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE)); | 158 link_->SetText(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE)); |
159 #endif | 159 #endif |
160 link_->set_listener(this); | 160 link_->set_listener(this); |
161 link_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); | 161 link_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); |
162 link_->SetPressedColor(message_label_->enabled_color()); | 162 link_->SetPressedColor(message_label_->enabled_color()); |
163 link_->SetEnabledColor(message_label_->enabled_color()); | 163 link_->SetEnabledColor(message_label_->enabled_color()); |
164 link_->SetVisible(false); | 164 link_->SetVisible(false); |
165 | 165 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 const content::NotificationDetails& details) { | 506 const content::NotificationDetails& details) { |
507 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); | 507 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); |
508 UpdateForImmersiveState(); | 508 UpdateForImmersiveState(); |
509 } | 509 } |
510 | 510 |
511 void FullscreenExitBubbleViews::OnWidgetVisibilityChanged( | 511 void FullscreenExitBubbleViews::OnWidgetVisibilityChanged( |
512 views::Widget* widget, | 512 views::Widget* widget, |
513 bool visible) { | 513 bool visible) { |
514 UpdateMouseWatcher(); | 514 UpdateMouseWatcher(); |
515 } | 515 } |
OLD | NEW |