| 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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 DropdownBarHostDelegate* delegate) { | 36 DropdownBarHostDelegate* delegate) { |
| 37 DCHECK(view); | 37 DCHECK(view); |
| 38 DCHECK(delegate); | 38 DCHECK(delegate); |
| 39 | 39 |
| 40 view_ = view; | 40 view_ = view; |
| 41 delegate_ = delegate; | 41 delegate_ = delegate; |
| 42 | 42 |
| 43 // The |clip_view| exists to paint to a layer so that it can clip descendent | 43 // 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 | 44 // Views which also paint to a Layer. See http://crbug.com/589497 |
| 45 std::unique_ptr<views::View> clip_view(new views::View()); | 45 std::unique_ptr<views::View> clip_view(new views::View()); |
| 46 clip_view->SetPaintToLayer(true); | 46 clip_view->SetPaintToLayer(); |
| 47 clip_view->layer()->SetFillsBoundsOpaquely(false); | 47 clip_view->layer()->SetFillsBoundsOpaquely(false); |
| 48 clip_view->layer()->SetMasksToBounds(true); | 48 clip_view->layer()->SetMasksToBounds(true); |
| 49 clip_view->AddChildView(view_); | 49 clip_view->AddChildView(view_); |
| 50 | 50 |
| 51 // Initialize the host. | 51 // Initialize the host. |
| 52 host_.reset(new ThemeCopyingWidget(browser_view_->GetWidget())); | 52 host_.reset(new ThemeCopyingWidget(browser_view_->GetWidget())); |
| 53 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 53 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
| 54 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 54 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 55 params.parent = browser_view_->GetWidget()->GetNativeView(); | 55 params.parent = browser_view_->GetWidget()->GetNativeView(); |
| 56 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 56 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); | 228 escape, ui::AcceleratorManager::kNormalPriority, this); |
| 229 esc_accel_target_registered_ = true; | 229 esc_accel_target_registered_ = true; |
| 230 } | 230 } |
| 231 | 231 |
| 232 void DropdownBarHost::UnregisterAccelerators() { | 232 void DropdownBarHost::UnregisterAccelerators() { |
| 233 DCHECK(esc_accel_target_registered_); | 233 DCHECK(esc_accel_target_registered_); |
| 234 ui::Accelerator escape(ui::VKEY_ESCAPE, ui::EF_NONE); | 234 ui::Accelerator escape(ui::VKEY_ESCAPE, ui::EF_NONE); |
| 235 focus_manager_->UnregisterAccelerator(escape, this); | 235 focus_manager_->UnregisterAccelerator(escape, this); |
| 236 esc_accel_target_registered_ = false; | 236 esc_accel_target_registered_ = false; |
| 237 } | 237 } |
| OLD | NEW |