OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 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_EXTENSIONS_SIDEBAR_CONTAINER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SIDEBAR_CONTAINER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/scoped_observer.h" |
| 14 #include "chrome/browser/extensions/extension_view_host.h" |
| 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "content/public/browser/web_contents_delegate.h" |
| 18 #include "extensions/browser/extension_host_observer.h" |
| 19 |
| 20 namespace content { |
| 21 class WebContents; |
| 22 } |
| 23 |
| 24 namespace extensions { |
| 25 /////////////////////////////////////////////////////////////////////////////// |
| 26 // SidebarContainer |
| 27 // |
| 28 // Stores one particular sidebar state: sidebar's content, its content id, |
| 29 // tab it is linked to, mini tab icon, title etc. |
| 30 // |
| 31 class SidebarContainer : public content::NotificationObserver { |
| 32 public: |
| 33 // Interface to implement to listen for sidebar update notification. |
| 34 |
| 35 SidebarContainer(Browser* browser, |
| 36 content::WebContents* tab, |
| 37 const GURL& url); |
| 38 ~SidebarContainer() override; |
| 39 |
| 40 // Retruns HostContents sidebar is linked to. |
| 41 content::WebContents* host_contents() const { return host_->host_contents(); } |
| 42 |
| 43 // Returns TabContents sidebar is linked to. |
| 44 content::WebContents* web_contents() const { return tab_; } |
| 45 |
| 46 const std::string& extension_id() { return host_->extension_id(); } |
| 47 |
| 48 // content::NotificationObserver overrides. |
| 49 void Observe(int type, |
| 50 const content::NotificationSource& source, |
| 51 const content::NotificationDetails& details) override; |
| 52 |
| 53 private: |
| 54 scoped_ptr<extensions::ExtensionViewHost> host_; |
| 55 |
| 56 content::NotificationRegistrar registrar_; |
| 57 |
| 58 // Contents of the tab this sidebar is linked to. |
| 59 content::WebContents* tab_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(SidebarContainer); |
| 62 }; |
| 63 |
| 64 } // namespace extensions |
| 65 #endif // CHROME_BROWSER_EXTENSIONS_SIDEBAR_CONTAINER_H_ |
OLD | NEW |