Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: chrome/browser/ui/views/dropdown_bar_host.cc

Issue 6881107: Rework the way Widget::Init works: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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_view.h" 10 #include "chrome/browser/ui/views/dropdown_bar_view.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 animation_offset_(0), 47 animation_offset_(0),
48 focus_manager_(NULL), 48 focus_manager_(NULL),
49 esc_accel_target_registered_(false), 49 esc_accel_target_registered_(false),
50 is_visible_(false) { 50 is_visible_(false) {
51 } 51 }
52 52
53 void DropdownBarHost::Init(DropdownBarView* view) { 53 void DropdownBarHost::Init(DropdownBarView* view) {
54 view_ = view; 54 view_ = view;
55 55
56 // Initialize the host. 56 // Initialize the host.
57 host_.reset(CreateHost()); 57 host_.reset(views::Widget::CreateWidget());
58 host_->InitWithWidget(browser_view_->GetWidget(), gfx::Rect()); 58 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_CONTROL);
59 params.delete_on_destroy = false;
60 params.parent_widget = browser_view_->GetWidget();
61 host_->Init(params);
59 host_->SetContentsView(view_); 62 host_->SetContentsView(view_);
60 63
61 // Start listening to focus changes, so we can register and unregister our 64 // Start listening to focus changes, so we can register and unregister our
62 // own handler for Escape. 65 // own handler for Escape.
63 focus_manager_ = 66 focus_manager_ =
64 views::FocusManager::GetFocusManagerForNativeView(host_->GetNativeView()); 67 views::FocusManager::GetFocusManagerForNativeView(host_->GetNativeView());
65 if (focus_manager_) { 68 if (focus_manager_) {
66 focus_manager_->AddFocusChangeListener(this); 69 focus_manager_->AddFocusChangeListener(this);
67 } else { 70 } else {
68 // In some cases (see bug http://crbug.com/17056) it seems we may not have 71 // In some cases (see bug http://crbug.com/17056) it seems we may not have
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 focus_manager_->RegisterAccelerator(escape, this); 315 focus_manager_->RegisterAccelerator(escape, this);
313 esc_accel_target_registered_ = true; 316 esc_accel_target_registered_ = true;
314 } 317 }
315 318
316 void DropdownBarHost::UnregisterAccelerators() { 319 void DropdownBarHost::UnregisterAccelerators() {
317 DCHECK(esc_accel_target_registered_); 320 DCHECK(esc_accel_target_registered_);
318 views::Accelerator escape(ui::VKEY_ESCAPE, false, false, false); 321 views::Accelerator escape(ui::VKEY_ESCAPE, false, false, false);
319 focus_manager_->UnregisterAccelerator(escape, this); 322 focus_manager_->UnregisterAccelerator(escape, this);
320 esc_accel_target_registered_ = false; 323 esc_accel_target_registered_ = false;
321 } 324 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/dropdown_bar_host.h ('k') | chrome/browser/ui/views/dropdown_bar_host_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698