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

Side by Side Diff: chrome/browser/ui/views/bubble/border_widget_win.cc

Issue 7015051: Re-land: (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
« no previous file with comments | « chrome/browser/ui/views/browser_bubble_win.cc ('k') | chrome/browser/ui/views/bubble/bubble.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bubble/border_widget_win.h" 5 #include "chrome/browser/ui/views/bubble/border_widget_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "chrome/browser/ui/views/bubble/border_contents.h" 9 #include "chrome/browser/ui/views/bubble/border_contents.h"
10 #include "views/widget/widget.h"
10 11
11 BorderWidgetWin::BorderWidgetWin() 12 BorderWidgetWin::BorderWidgetWin()
12 : border_contents_(NULL) { 13 : views::WidgetWin(new views::Widget),
14 border_contents_(NULL) {
13 } 15 }
14 16
15 void BorderWidgetWin::InitBorderWidgetWin(BorderContents* border_contents, 17 void BorderWidgetWin::InitBorderWidgetWin(BorderContents* border_contents,
16 HWND owner) { 18 HWND owner) {
17 DCHECK(!border_contents_); 19 DCHECK(!border_contents_);
18 border_contents_ = border_contents; 20 border_contents_ = border_contents;
19 border_contents_->Init(); 21 border_contents_->Init();
20 22
21 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 23 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
22 params.transparent = true; 24 params.transparent = true;
23 params.parent = owner; 25 params.parent = owner;
26 params.native_widget = this;
24 GetWidget()->Init(params); 27 GetWidget()->Init(params);
25 SetContentsView(border_contents_); 28 GetWidget()->SetContentsView(border_contents_);
26 SetWindowPos(owner, 0, 0, 0, 0, 29 SetWindowPos(owner, 0, 0, 0, 0,
27 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOREDRAW); 30 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOREDRAW);
28 } 31 }
29 32
30 gfx::Rect BorderWidgetWin::SizeAndGetBounds( 33 gfx::Rect BorderWidgetWin::SizeAndGetBounds(
31 const gfx::Rect& position_relative_to, 34 const gfx::Rect& position_relative_to,
32 BubbleBorder::ArrowLocation arrow_location, 35 BubbleBorder::ArrowLocation arrow_location,
33 const gfx::Size& contents_size) { 36 const gfx::Size& contents_size) {
34 // Ask the border view to calculate our bounds (and our contents'). 37 // Ask the border view to calculate our bounds (and our contents').
35 gfx::Rect contents_bounds; 38 gfx::Rect contents_bounds;
36 gfx::Rect window_bounds; 39 gfx::Rect window_bounds;
37 border_contents_->SizeAndGetBounds(position_relative_to, arrow_location, 40 border_contents_->SizeAndGetBounds(position_relative_to, arrow_location,
38 false, contents_size, &contents_bounds, 41 false, contents_size, &contents_bounds,
39 &window_bounds); 42 &window_bounds);
40 SetBounds(window_bounds); 43 GetWidget()->SetBounds(window_bounds);
41 44
42 // Return |contents_bounds| in screen coordinates. 45 // Return |contents_bounds| in screen coordinates.
43 contents_bounds.Offset(window_bounds.origin()); 46 contents_bounds.Offset(window_bounds.origin());
44 return contents_bounds; 47 return contents_bounds;
45 } 48 }
46 49
47 LRESULT BorderWidgetWin::OnMouseActivate(UINT message, 50 LRESULT BorderWidgetWin::OnMouseActivate(UINT message,
48 WPARAM w_param, 51 WPARAM w_param,
49 LPARAM l_param) { 52 LPARAM l_param) {
50 // Never activate. 53 // Never activate.
51 return MA_NOACTIVATE; 54 return MA_NOACTIVATE;
52 } 55 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/browser_bubble_win.cc ('k') | chrome/browser/ui/views/bubble/bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698