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

Side by Side Diff: chrome/browser/ui/views/browser_bubble_win.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/browser_bubble.h" 5 #include "chrome/browser/ui/views/browser_bubble.h"
6 6
7 #include "chrome/browser/ui/views/bubble/border_contents.h" 7 #include "chrome/browser/ui/views/bubble/border_contents.h"
8 #include "chrome/browser/ui/views/bubble/border_widget_win.h" 8 #include "chrome/browser/ui/views/bubble/border_widget_win.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h" 9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "views/widget/root_view.h" 10 #include "views/widget/root_view.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 BrowserBubble* bubble_; 102 BrowserBubble* bubble_;
103 BorderWidgetWin* border_widget_; 103 BorderWidgetWin* border_widget_;
104 104
105 DISALLOW_COPY_AND_ASSIGN(BubbleWidget); 105 DISALLOW_COPY_AND_ASSIGN(BubbleWidget);
106 }; 106 };
107 107
108 void BrowserBubble::InitPopup() { 108 void BrowserBubble::InitPopup() {
109 // popup_ is a Widget, but we need to do some WidgetWin stuff first, then 109 // popup_ is a Widget, but we need to do some WidgetWin stuff first, then
110 // we'll assign it into popup_. 110 // we'll assign it into popup_.
111 BubbleWidget* pop = new BubbleWidget(this); 111 BubbleWidget* pop = new BubbleWidget(this);
112 popup_ = pop;
112 113
113 BorderWidgetWin* border_widget = pop->border_widget(); 114 BorderWidgetWin* border_widget = pop->border_widget();
114 border_widget->Init(new BorderContents, frame_->GetNativeView()); 115 border_widget->InitBorderWidgetWin(new BorderContents,
116 frame_->GetNativeView());
115 117
116 // We make the BorderWidgetWin the owner of the Bubble HWND, so that the 118 // We make the BorderWidgetWin the owner of the Bubble HWND, so that the
117 // latter is displayed on top of the former. 119 // latter is displayed on top of the former.
118 pop->Init(border_widget->GetNativeView(), gfx::Rect()); 120 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP);
119 pop->SetContentsView(view_); 121 params.parent = border_widget->GetNativeView();
122 popup_->Init(params);
123 popup_->SetContentsView(view_);
120 124
121 popup_ = pop;
122 125
123 ResizeToView(); 126 ResizeToView();
124 Reposition(); 127 Reposition();
125 AttachToBrowser(); 128 AttachToBrowser();
126 } 129 }
127 130
128 void BrowserBubble::MovePopup(int x, int y, int w, int h) { 131 void BrowserBubble::MovePopup(int x, int y, int w, int h) {
129 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); 132 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_);
130 pop->SetBounds(gfx::Rect(x, y, w, h)); 133 pop->SetBounds(gfx::Rect(x, y, w, h));
131 } 134 }
(...skipping 17 matching lines...) Expand all
149 void BrowserBubble::ResizeToView() { 152 void BrowserBubble::ResizeToView() {
150 BorderWidgetWin* border_widget = 153 BorderWidgetWin* border_widget =
151 static_cast<BubbleWidget*>(popup_)->border_widget(); 154 static_cast<BubbleWidget*>(popup_)->border_widget();
152 155
153 gfx::Rect window_bounds; 156 gfx::Rect window_bounds;
154 window_bounds = border_widget->SizeAndGetBounds(GetAbsoluteRelativeTo(), 157 window_bounds = border_widget->SizeAndGetBounds(GetAbsoluteRelativeTo(),
155 arrow_location_, view_->size()); 158 arrow_location_, view_->size());
156 159
157 SetAbsoluteBounds(window_bounds); 160 SetAbsoluteBounds(window_bounds);
158 } 161 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/browser_bubble_gtk.cc ('k') | chrome/browser/ui/views/bubble/border_widget_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698