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

Side by Side Diff: chrome/browser/chromeos/notifications/balloon_view.cc

Issue 7031053: Make Widget ownership a little clearer by expressing it in terms of an enum. (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 | « no previous file | chrome/browser/ui/views/dropdown_bar_host.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/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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 263 }
264 } 264 }
265 265
266 void BalloonViewImpl::ViewHierarchyChanged( 266 void BalloonViewImpl::ViewHierarchyChanged(
267 bool is_add, View* parent, View* child) { 267 bool is_add, View* parent, View* child) {
268 if (is_add && GetWidget() && !control_view_host_.get() && controls_) { 268 if (is_add && GetWidget() && !control_view_host_.get() && controls_) {
269 control_view_host_.reset(new views::Widget); 269 control_view_host_.reset(new views::Widget);
270 views::Widget::InitParams params( 270 views::Widget::InitParams params(
271 views::Widget::InitParams::TYPE_CONTROL); 271 views::Widget::InitParams::TYPE_CONTROL);
272 params.double_buffer = true; 272 params.double_buffer = true;
273 params.delete_on_destroy = false; 273 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
274 params.parent = GetParentNativeView(); 274 params.parent = GetParentNativeView();
275 control_view_host_->Init(params); 275 control_view_host_->Init(params);
276 NotificationControlView* control = new NotificationControlView(this); 276 NotificationControlView* control = new NotificationControlView(this);
277 control_view_host_->SetContentsView(control); 277 control_view_host_->SetContentsView(control);
278 } 278 }
279 if (!is_add && this == child && control_view_host_.get() && controls_) 279 if (!is_add && this == child && control_view_host_.get() && controls_)
280 control_view_host_.release()->CloseNow(); 280 control_view_host_.release()->CloseNow();
281 } 281 }
282 282
283 gfx::Size BalloonViewImpl::GetPreferredSize() { 283 gfx::Size BalloonViewImpl::GetPreferredSize() {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 service->DenyPermission(balloon_->notification().origin_url()); 345 service->DenyPermission(balloon_->notification().origin_url());
346 } 346 }
347 347
348 gfx::NativeView BalloonViewImpl::GetParentNativeView() { 348 gfx::NativeView BalloonViewImpl::GetParentNativeView() {
349 RenderWidgetHostView* view = html_contents_->render_view_host()->view(); 349 RenderWidgetHostView* view = html_contents_->render_view_host()->view();
350 DCHECK(view); 350 DCHECK(view);
351 return view->GetNativeView(); 351 return view->GetNativeView();
352 } 352 }
353 353
354 } // namespace chromeos 354 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/dropdown_bar_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698