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

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

Issue 6881107: Rework the way Widget::Init works: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 <vector> 7 #include <vector>
8 8
9 #include "chrome/browser/ui/views/bubble/border_contents.h" 9 #include "chrome/browser/ui/views/bubble/border_contents.h"
10 #include "chrome/browser/ui/views/frame/browser_view.h" 10 #include "chrome/browser/ui/views/frame/browser_view.h"
11 #include "views/widget/root_view.h" 11 #include "views/widget/root_view.h"
12 #include "views/widget/widget_gtk.h" 12 #include "views/widget/widget_gtk.h"
13 13
14 #if defined(OS_CHROMEOS) 14 #if defined(OS_CHROMEOS)
15 #include "chrome/browser/chromeos/wm_ipc.h" 15 #include "chrome/browser/chromeos/wm_ipc.h"
16 #include "third_party/cros/chromeos_wm_ipc_enums.h" 16 #include "third_party/cros/chromeos_wm_ipc_enums.h"
17 #endif 17 #endif
18 18
19 using std::vector; 19 using std::vector;
20 20
21 namespace { 21 namespace {
22 22
23 class BubbleWidget : public views::WidgetGtk { 23 class BubbleWidget : public views::WidgetGtk {
24 public: 24 public:
25 explicit BubbleWidget(BrowserBubble* bubble) 25 explicit BubbleWidget(BrowserBubble* bubble)
26 : views::WidgetGtk(views::WidgetGtk::TYPE_WINDOW), 26 : bubble_(bubble),
27 bubble_(bubble),
28 border_contents_(new BorderContents) { 27 border_contents_(new BorderContents) {
29 border_contents_->Init(); 28 border_contents_->Init();
30 } 29 }
31 30
32 void ShowAndActivate(bool activate) { 31 void ShowAndActivate(bool activate) {
33 // TODO: honor activate. 32 // TODO: honor activate.
34 views::WidgetGtk::Show(); 33 views::WidgetGtk::Show();
35 } 34 }
36 35
37 virtual void Close() { 36 virtual void Close() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 DISALLOW_COPY_AND_ASSIGN(BubbleWidget); 87 DISALLOW_COPY_AND_ASSIGN(BubbleWidget);
89 }; 88 };
90 89
91 } // namespace 90 } // namespace
92 91
93 void BrowserBubble::InitPopup() { 92 void BrowserBubble::InitPopup() {
94 // TODO(port) 93 // TODO(port)
95 BubbleWidget* pop = new BubbleWidget(this); 94 BubbleWidget* pop = new BubbleWidget(this);
96 pop->MakeTransparent(); 95 pop->MakeTransparent();
97 pop->make_transient_to_parent(); 96 pop->make_transient_to_parent();
98 pop->Init(frame_->GetNativeView(), gfx::Rect()); 97 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_WINDOW);
98 params.parent = frame_->GetNativeView();
99 pop->Init(params);
99 #if defined(OS_CHROMEOS) 100 #if defined(OS_CHROMEOS)
100 { 101 {
101 vector<int> params; 102 vector<int> params;
102 params.push_back(0); // don't show while screen is locked 103 params.push_back(0); // don't show while screen is locked
103 chromeos::WmIpc::instance()->SetWindowType( 104 chromeos::WmIpc::instance()->SetWindowType(
104 pop->GetNativeView(), 105 pop->GetNativeView(),
105 chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE, 106 chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE,
106 &params); 107 &params);
107 } 108 }
108 #endif 109 #endif
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 gfx::Rect contents_bounds; 156 gfx::Rect contents_bounds;
156 border_contents->SizeAndGetBounds(GetAbsoluteRelativeTo(), 157 border_contents->SizeAndGetBounds(GetAbsoluteRelativeTo(),
157 arrow_location_, false, view_->size(), 158 arrow_location_, false, view_->size(),
158 &contents_bounds, &window_bounds); 159 &contents_bounds, &window_bounds);
159 160
160 border_contents->SetBoundsRect(gfx::Rect(gfx::Point(), window_bounds.size())); 161 border_contents->SetBoundsRect(gfx::Rect(gfx::Point(), window_bounds.size()));
161 view_->SetBoundsRect(contents_bounds); 162 view_->SetBoundsRect(contents_bounds);
162 163
163 SetAbsoluteBounds(window_bounds); 164 SetAbsoluteBounds(window_bounds);
164 } 165 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.cc ('k') | chrome/browser/ui/views/browser_bubble_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698