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/dropdown_bar_host.h" | 5 #include "chrome/browser/ui/views/dropdown_bar_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
10 #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h" | 10 #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h" |
11 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
12 #include "chrome/browser/ui/views/theme_copying_widget.h" | 12 #include "chrome/browser/ui/views/theme_copying_widget.h" |
| 13 #include "ui/compositor/layer_type.h" |
13 #include "ui/events/keycodes/keyboard_codes.h" | 14 #include "ui/events/keycodes/keyboard_codes.h" |
14 #include "ui/gfx/animation/slide_animation.h" | 15 #include "ui/gfx/animation/slide_animation.h" |
15 #include "ui/gfx/scrollbar_size.h" | 16 #include "ui/gfx/scrollbar_size.h" |
16 #include "ui/views/focus/external_focus_tracker.h" | 17 #include "ui/views/focus/external_focus_tracker.h" |
17 #include "ui/views/focus/view_storage.h" | 18 #include "ui/views/focus/view_storage.h" |
18 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
19 | 20 |
20 // static | 21 // static |
21 bool DropdownBarHost::disable_animations_during_testing_ = false; | 22 bool DropdownBarHost::disable_animations_during_testing_ = false; |
22 | 23 |
(...skipping 13 matching lines...) Expand all Loading... |
36 DropdownBarHostDelegate* delegate) { | 37 DropdownBarHostDelegate* delegate) { |
37 DCHECK(view); | 38 DCHECK(view); |
38 DCHECK(delegate); | 39 DCHECK(delegate); |
39 | 40 |
40 view_ = view; | 41 view_ = view; |
41 delegate_ = delegate; | 42 delegate_ = delegate; |
42 | 43 |
43 // The |clip_view| exists to paint to a layer so that it can clip descendent | 44 // The |clip_view| exists to paint to a layer so that it can clip descendent |
44 // Views which also paint to a Layer. See http://crbug.com/589497 | 45 // Views which also paint to a Layer. See http://crbug.com/589497 |
45 std::unique_ptr<views::View> clip_view(new views::View()); | 46 std::unique_ptr<views::View> clip_view(new views::View()); |
46 clip_view->SetPaintToLayer(true); | 47 clip_view->SetPaintToLayer(ui::LAYER_TEXTURED); |
47 clip_view->layer()->SetFillsBoundsOpaquely(false); | 48 clip_view->layer()->SetFillsBoundsOpaquely(false); |
48 clip_view->layer()->SetMasksToBounds(true); | 49 clip_view->layer()->SetMasksToBounds(true); |
49 clip_view->AddChildView(view_); | 50 clip_view->AddChildView(view_); |
50 | 51 |
51 // Initialize the host. | 52 // Initialize the host. |
52 host_.reset(new ThemeCopyingWidget(browser_view_->GetWidget())); | 53 host_.reset(new ThemeCopyingWidget(browser_view_->GetWidget())); |
53 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 54 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
54 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 55 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
55 params.parent = browser_view_->GetWidget()->GetNativeView(); | 56 params.parent = browser_view_->GetWidget()->GetNativeView(); |
56 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 57 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 escape, ui::AcceleratorManager::kNormalPriority, this); | 229 escape, ui::AcceleratorManager::kNormalPriority, this); |
229 esc_accel_target_registered_ = true; | 230 esc_accel_target_registered_ = true; |
230 } | 231 } |
231 | 232 |
232 void DropdownBarHost::UnregisterAccelerators() { | 233 void DropdownBarHost::UnregisterAccelerators() { |
233 DCHECK(esc_accel_target_registered_); | 234 DCHECK(esc_accel_target_registered_); |
234 ui::Accelerator escape(ui::VKEY_ESCAPE, ui::EF_NONE); | 235 ui::Accelerator escape(ui::VKEY_ESCAPE, ui::EF_NONE); |
235 focus_manager_->UnregisterAccelerator(escape, this); | 236 focus_manager_->UnregisterAccelerator(escape, this); |
236 esc_accel_target_registered_ = false; | 237 esc_accel_target_registered_ = false; |
237 } | 238 } |
OLD | NEW |