| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |