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

Side by Side Diff: chrome/browser/chromeos/notifications/balloon_view.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/chromeos/notifications/balloon_view.h" 5 #include "chrome/browser/chromeos/notifications/balloon_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 if (html_contents_->render_view_host()) { 260 if (html_contents_->render_view_host()) {
261 RenderWidgetHostView* view = html_contents_->render_view_host()->view(); 261 RenderWidgetHostView* view = html_contents_->render_view_host()->view();
262 if (view) 262 if (view)
263 view->SetSize(size); 263 view->SetSize(size);
264 } 264 }
265 } 265 }
266 266
267 void BalloonViewImpl::ViewHierarchyChanged( 267 void BalloonViewImpl::ViewHierarchyChanged(
268 bool is_add, View* parent, View* child) { 268 bool is_add, View* parent, View* child) {
269 if (is_add && GetWidget() && !control_view_host_.get() && controls_) { 269 if (is_add && GetWidget() && !control_view_host_.get() && controls_) {
270 control_view_host_.reset(views::Widget::CreateWidget());
271 static_cast<views::WidgetGtk*>(control_view_host_.get())->
272 EnableDoubleBuffer(true);
270 views::Widget::CreateParams params( 273 views::Widget::CreateParams params(
271 views::Widget::CreateParams::TYPE_CONTROL); 274 views::Widget::CreateParams::TYPE_CONTROL);
272 params.delete_on_destroy = false; 275 params.delete_on_destroy = false;
273 control_view_host_.reset(views::Widget::CreateWidget(params)); 276 params.parent = GetParentNativeView();
274 static_cast<views::WidgetGtk*>(control_view_host_.get())-> 277 control_view_host_->Init(params);
275 EnableDoubleBuffer(true);
276 control_view_host_->Init(GetParentNativeView(), gfx::Rect());
277 NotificationControlView* control = new NotificationControlView(this); 278 NotificationControlView* control = new NotificationControlView(this);
278 control_view_host_->SetContentsView(control); 279 control_view_host_->SetContentsView(control);
279 } 280 }
280 if (!is_add && this == child && control_view_host_.get() && controls_) { 281 if (!is_add && this == child && control_view_host_.get() && controls_)
281 control_view_host_.release()->CloseNow(); 282 control_view_host_.release()->CloseNow();
282 }
283 } 283 }
284 284
285 //////////////////////////////////////////////////////////////////////////////// 285 ////////////////////////////////////////////////////////////////////////////////
286 // NotificationObserver overrides. 286 // NotificationObserver overrides.
287 287
288 void BalloonViewImpl::Observe(NotificationType type, 288 void BalloonViewImpl::Observe(NotificationType type,
289 const NotificationSource& source, 289 const NotificationSource& source,
290 const NotificationDetails& details) { 290 const NotificationDetails& details) {
291 if (type != NotificationType::NOTIFY_BALLOON_DISCONNECTED) { 291 if (type != NotificationType::NOTIFY_BALLOON_DISCONNECTED) {
292 NOTREACHED(); 292 NOTREACHED();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 service->DenyPermission(balloon_->notification().origin_url()); 343 service->DenyPermission(balloon_->notification().origin_url());
344 } 344 }
345 345
346 gfx::NativeView BalloonViewImpl::GetParentNativeView() { 346 gfx::NativeView BalloonViewImpl::GetParentNativeView() {
347 RenderWidgetHostView* view = html_contents_->render_view_host()->view(); 347 RenderWidgetHostView* view = html_contents_->render_view_host()->view();
348 DCHECK(view); 348 DCHECK(view);
349 return view->GetNativeView(); 349 return view->GetNativeView();
350 } 350 }
351 351
352 } // namespace chromeos 352 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.cc ('k') | chrome/browser/chromeos/notifications/notification_panel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698