| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/notifications/balloon_view_host.h" | 5 #include "chrome/browser/views/notifications/balloon_view_host.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/notifications/balloon.h" | 9 #include "chrome/browser/notifications/balloon.h" |
| 10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 void BalloonViewHost::UpdatePreferredSize(const gfx::Size& new_size) { | 97 void BalloonViewHost::UpdatePreferredSize(const gfx::Size& new_size) { |
| 98 balloon_->SetContentPreferredSize(new_size); | 98 balloon_->SetContentPreferredSize(new_size); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void BalloonViewHost::Init(gfx::NativeView parent_hwnd) { | 101 void BalloonViewHost::Init(gfx::NativeView parent_hwnd) { |
| 102 DCHECK(!render_view_host_) << "BalloonViewHost already initialized."; | 102 DCHECK(!render_view_host_) << "BalloonViewHost already initialized."; |
| 103 RenderViewHost* rvh = new RenderViewHost(site_instance_.get(), | 103 RenderViewHost* rvh = new RenderViewHost(site_instance_.get(), |
| 104 this, MSG_ROUTING_NONE); | 104 this, MSG_ROUTING_NONE, |
| 105 kInvalidSessionStorageNamespaceId); |
| 105 render_view_host_ = rvh; | 106 render_view_host_ = rvh; |
| 106 | 107 |
| 107 // Pointer is owned by the RVH. | 108 // Pointer is owned by the RVH. |
| 108 RenderWidgetHostView* view = RenderWidgetHostView::CreateViewForWidget(rvh); | 109 RenderWidgetHostView* view = RenderWidgetHostView::CreateViewForWidget(rvh); |
| 109 rvh->set_view(view); | 110 rvh->set_view(view); |
| 110 | 111 |
| 111 // TODO(johnnyg): http://crbug.com/23954. Need a cross-platform solution. | 112 // TODO(johnnyg): http://crbug.com/23954. Need a cross-platform solution. |
| 112 #if defined(OS_WIN) | 113 #if defined(OS_WIN) |
| 113 RenderWidgetHostViewWin* view_win = | 114 RenderWidgetHostViewWin* view_win = |
| 114 static_cast<RenderWidgetHostViewWin*>(view); | 115 static_cast<RenderWidgetHostViewWin*>(view); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 126 rvh->NavigateToURL(balloon_->notification().content_url()); | 127 rvh->NavigateToURL(balloon_->notification().content_url()); |
| 127 initialized_ = true; | 128 initialized_ = true; |
| 128 } | 129 } |
| 129 | 130 |
| 130 void BalloonViewHost::ViewHierarchyChanged(bool is_add, views::View* parent, | 131 void BalloonViewHost::ViewHierarchyChanged(bool is_add, views::View* parent, |
| 131 views::View* child) { | 132 views::View* child) { |
| 132 NativeViewHost::ViewHierarchyChanged(is_add, parent, child); | 133 NativeViewHost::ViewHierarchyChanged(is_add, parent, child); |
| 133 if (is_add && GetWidget() && !initialized_) | 134 if (is_add && GetWidget() && !initialized_) |
| 134 Init(GetWidget()->GetNativeView()); | 135 Init(GetWidget()->GetNativeView()); |
| 135 } | 136 } |
| OLD | NEW |