| 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/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.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/ui/views/bubble/bubble.h" | |
| 11 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| 12 #include "ui/base/animation/slide_animation.h" | 11 #include "ui/base/animation/slide_animation.h" |
| 13 #include "ui/base/keycodes/keyboard_codes.h" | 12 #include "ui/base/keycodes/keyboard_codes.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/gfx/canvas_skia.h" | 15 #include "ui/gfx/canvas_skia.h" |
| 17 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
| 18 #include "views/bubble/bubble_border.h" | 17 #include "views/bubble/bubble_border.h" |
| 19 #include "views/controls/button/text_button.h" | 18 #include "views/controls/button/text_button.h" |
| 20 #include "views/controls/link.h" | 19 #include "views/controls/link.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #if !defined(OS_CHROMEOS) | 73 #if !defined(OS_CHROMEOS) |
| 75 browser_fullscreen_exit_text_ = | 74 browser_fullscreen_exit_text_ = |
| 76 l10n_util::GetStringFUTF16(IDS_EXIT_FULLSCREEN_MODE, accelerator); | 75 l10n_util::GetStringFUTF16(IDS_EXIT_FULLSCREEN_MODE, accelerator); |
| 77 #else | 76 #else |
| 78 browser_fullscreen_exit_text_ = | 77 browser_fullscreen_exit_text_ = |
| 79 l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE); | 78 l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE); |
| 80 #endif | 79 #endif |
| 81 | 80 |
| 82 views::BubbleBorder* bubble_border = | 81 views::BubbleBorder* bubble_border = |
| 83 new views::BubbleBorder(views::BubbleBorder::NONE); | 82 new views::BubbleBorder(views::BubbleBorder::NONE); |
| 84 bubble_border->set_background_color(Bubble::kBackgroundColor); | |
| 85 set_background(new views::BubbleBackground(bubble_border)); | 83 set_background(new views::BubbleBackground(bubble_border)); |
| 86 set_border(bubble_border); | 84 set_border(bubble_border); |
| 87 set_focusable(false); | 85 set_focusable(false); |
| 88 | 86 |
| 89 message_label_.set_parent_owned(false); | 87 message_label_.set_parent_owned(false); |
| 90 message_label_.SetFont(ResourceBundle::GetSharedInstance().GetFont( | 88 message_label_.SetFont(ResourceBundle::GetSharedInstance().GetFont( |
| 91 ResourceBundle::MediumFont)); | 89 ResourceBundle::MediumFont)); |
| 92 | 90 |
| 93 link_.set_parent_owned(false); | 91 link_.set_parent_owned(false); |
| 94 link_.set_collapse_when_hidden(false); | 92 link_.set_collapse_when_hidden(false); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 size_animation_(new ui::SlideAnimation(this)) { | 213 size_animation_(new ui::SlideAnimation(this)) { |
| 216 size_animation_->Reset(1); | 214 size_animation_->Reset(1); |
| 217 | 215 |
| 218 // Create the contents view. | 216 // Create the contents view. |
| 219 ui::Accelerator accelerator(ui::VKEY_UNKNOWN, false, false, false); | 217 ui::Accelerator accelerator(ui::VKEY_UNKNOWN, false, false, false); |
| 220 bool got_accelerator = frame->GetAccelerator(IDC_FULLSCREEN, &accelerator); | 218 bool got_accelerator = frame->GetAccelerator(IDC_FULLSCREEN, &accelerator); |
| 221 DCHECK(got_accelerator); | 219 DCHECK(got_accelerator); |
| 222 view_ = new FullscreenExitView( | 220 view_ = new FullscreenExitView( |
| 223 this, accelerator.GetShortcutText(), url, bubble_type_); | 221 this, accelerator.GetShortcutText(), url, bubble_type_); |
| 224 | 222 |
| 223 // TODO(yzshen): Change to use the new views bubble, BubbleDelegateView. |
| 225 // Initialize the popup. | 224 // Initialize the popup. |
| 226 popup_ = new views::Widget; | 225 popup_ = new views::Widget; |
| 227 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 226 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 228 params.transparent = true; | 227 params.transparent = true; |
| 229 params.can_activate = false; | 228 params.can_activate = false; |
| 230 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 229 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 231 params.parent = frame->GetNativeView(); | 230 params.parent = frame->GetNativeView(); |
| 232 params.bounds = GetPopupRect(false); | 231 params.bounds = GetPopupRect(false); |
| 233 popup_->Init(params); | 232 popup_->Init(params); |
| 234 gfx::Size size = GetPopupRect(true).size(); | 233 gfx::Size size = GetPopupRect(true).size(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 size.set_height(size.height() - popup_bottom + y_offset); | 346 size.set_height(size.height() - popup_bottom + y_offset); |
| 348 origin.set_y(origin.y() - y_offset); | 347 origin.set_y(origin.y() - y_offset); |
| 349 } | 348 } |
| 350 return gfx::Rect(origin, size); | 349 return gfx::Rect(origin, size); |
| 351 } | 350 } |
| 352 | 351 |
| 353 void FullscreenExitBubbleViews::StartWatchingMouseIfNecessary() { | 352 void FullscreenExitBubbleViews::StartWatchingMouseIfNecessary() { |
| 354 if (!fullscreen_bubble::ShowButtonsForType(bubble_type_)) | 353 if (!fullscreen_bubble::ShowButtonsForType(bubble_type_)) |
| 355 StartWatchingMouse(); | 354 StartWatchingMouse(); |
| 356 } | 355 } |
| OLD | NEW |