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