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/ui/views/notifications/balloon_view_host.h" | 5 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" |
6 | 6 |
7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
8 #include "content/browser/renderer_host/render_view_host.h" | 8 #include "content/browser/renderer_host/render_view_host.h" |
9 #include "content/browser/renderer_host/render_widget_host_view.h" | 9 #include "content/browser/renderer_host/render_widget_host_view.h" |
10 #include "content/browser/tab_contents/tab_contents.h" | 10 #include "content/browser/tab_contents/tab_contents.h" |
11 #include "content/public/browser/content_browser_client.h" | 11 #include "content/public/browser/content_browser_client.h" |
12 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
13 | 13 |
14 #if defined(TOUCH_UI) && !defined(USE_AURA) | |
15 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" | |
16 #endif | |
17 | |
18 class BalloonViewHostView : public views::NativeViewHost { | 14 class BalloonViewHostView : public views::NativeViewHost { |
19 public: | 15 public: |
20 explicit BalloonViewHostView(BalloonViewHost* host) | 16 explicit BalloonViewHostView(BalloonViewHost* host) |
21 : host_(host), | 17 : host_(host), |
22 initialized_(false) { | 18 initialized_(false) { |
23 } | 19 } |
24 | 20 |
25 virtual void ViewHierarchyChanged(bool is_add, | 21 virtual void ViewHierarchyChanged(bool is_add, |
26 views::View* parent, | 22 views::View* parent, |
27 views::View* child) { | 23 views::View* child) { |
(...skipping 19 matching lines...) Expand all Loading... |
47 BalloonViewHost::~BalloonViewHost() { | 43 BalloonViewHost::~BalloonViewHost() { |
48 Shutdown(); | 44 Shutdown(); |
49 } | 45 } |
50 | 46 |
51 void BalloonViewHost::Init(gfx::NativeView parent_native_view) { | 47 void BalloonViewHost::Init(gfx::NativeView parent_native_view) { |
52 parent_native_view_ = parent_native_view; | 48 parent_native_view_ = parent_native_view; |
53 BalloonHost::Init(); | 49 BalloonHost::Init(); |
54 | 50 |
55 RenderWidgetHostView* render_widget_host_view = | 51 RenderWidgetHostView* render_widget_host_view = |
56 tab_contents_->render_view_host()->view(); | 52 tab_contents_->render_view_host()->view(); |
57 #if defined(TOUCH_UI) && !defined(USE_AURA) | 53 |
58 RenderWidgetHostViewViews* view_views = | |
59 static_cast<RenderWidgetHostViewViews*>(render_widget_host_view); | |
60 native_host_->AttachToView(view_views); | |
61 #else | |
62 native_host_->Attach(render_widget_host_view->GetNativeView()); | 54 native_host_->Attach(render_widget_host_view->GetNativeView()); |
63 #endif | |
64 } | 55 } |
OLD | NEW |