OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_BALLOON_CONTENTS_H_ |
| 7 |
| 8 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 9 #include "views/controls/native/native_view_host.h" |
| 10 #include "webkit/glue/webpreferences.h" |
| 11 |
| 12 class Balloon; |
| 13 class Profile; |
| 14 class SiteInstance; |
| 15 class RenderViewHost; |
| 16 |
| 17 class BalloonContents : public views::NativeViewHost, |
| 18 public RenderViewHostDelegate { |
| 19 public: |
| 20 explicit BalloonContents(Balloon* balloon); |
| 21 |
| 22 // Stops showing the balloon. |
| 23 void Shutdown(); |
| 24 |
| 25 // RenderViewHostDelegate implementations. |
| 26 virtual WebPreferences GetWebkitPrefs(); |
| 27 virtual RendererPreferences GetRendererPrefs() const; |
| 28 virtual SiteInstance* GetSiteInstance() const; |
| 29 virtual Profile* GetProfile() const; |
| 30 virtual const GURL& GetURL() const; |
| 31 virtual void RequestOpenURL(const GURL& url, |
| 32 const GURL& referrer, |
| 33 WindowOpenDisposition disposition); |
| 34 virtual void RendererReady(RenderViewHost* render_view_host); |
| 35 virtual void RendererGone(RenderViewHost* render_view_host); |
| 36 virtual void UpdateTitle(RenderViewHost* render_view_host, |
| 37 int32 page_id, |
| 38 const std::wstring& title); |
| 39 virtual int GetBrowserWindowID() const { return -1; } |
| 40 virtual ViewType::Type GetRenderViewType() const { return ViewType::TAB_CONTEN
TS; } |
| 41 |
| 42 // Accessors. |
| 43 RenderViewHost* render_view_host() const { return render_view_host_; } |
| 44 const std::wstring& title() const { return title_; } |
| 45 |
| 46 private: |
| 47 // View overrides. |
| 48 virtual void ViewHierarchyChanged(bool is_add, views::View *parent, views::Vie
w *child); |
| 49 |
| 50 // Initialize the view, parented to |parent|, and show it. |
| 51 void Init(HWND parent); |
| 52 |
| 53 // Helper functions for sending notifications. |
| 54 void NotifyConnected(); |
| 55 void NotifyDisconnected(); |
| 56 |
| 57 // True after Init() has completed. |
| 58 bool initialized_; |
| 59 |
| 60 // The associated balloon. |
| 61 Balloon* balloon_; |
| 62 |
| 63 // The host HTML renderer. |
| 64 RenderViewHost* render_view_host_; |
| 65 |
| 66 // Indicates whether we should notify about disconnection of this balloon. |
| 67 // This is used to ensure disconnection notifications only happen if |
| 68 // a connection notification has happened and that they happen only once. |
| 69 bool notify_disconnection_; |
| 70 |
| 71 // The title of the balloon page. |
| 72 std::wstring title_; |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(BalloonContents); |
| 75 }; |
| 76 |
| 77 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_CONTENTS_H_ |
OLD | NEW |