Index: chrome/browser/extensions/sidebar_container.h |
diff --git a/chrome/browser/extensions/sidebar_container.h b/chrome/browser/extensions/sidebar_container.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dae09abd9f39d8abe4c5e04c40edde23021c274c |
--- /dev/null |
+++ b/chrome/browser/extensions/sidebar_container.h |
@@ -0,0 +1,77 @@ |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_EXTENSIONS_SIDEBAR_CONTAINER_H_ |
+#define CHROME_BROWSER_EXTENSIONS_SIDEBAR_CONTAINER_H_ |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/scoped_observer.h" |
+#include "chrome/browser/extensions/extension_view_host.h" |
+#include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
+#include "content/public/browser/notification_observer.h" |
+#include "content/public/browser/notification_registrar.h" |
+#include "content/public/browser/web_contents_delegate.h" |
+#include "extensions/browser/extension_host_observer.h" |
+ |
+class Browser; |
+ |
+namespace content { |
+class WebContents; |
+} |
+ |
+namespace extensions { |
+/////////////////////////////////////////////////////////////////////////////// |
Devlin
2015/06/19 19:56:09
nit: We don't really use this comment syntax that
ltilve
2015/06/28 22:44:19
Done.
|
+// SidebarContainer |
+// |
+// Stores one particular sidebar state: sidebar's content, its content id, |
+// tab it is linked to, mini tab icon, title etc. |
+// |
+class SidebarContainer : public content::NotificationObserver, |
+ public TabStripModelObserver { |
+ public: |
+ // Interface to implement to listen for sidebar update notification. |
Devlin
2015/06/19 19:56:09
?
ltilve
2015/06/28 22:44:19
Done. Removed wrong comment.
|
+ |
+ SidebarContainer(Browser* browser, |
+ content::WebContents* tab, |
+ const GURL& url); |
+ ~SidebarContainer() override; |
+ |
+ // Retruns HostContents sidebar is linked to. |
Devlin
2015/06/19 19:56:09
typo
ltilve
2015/06/28 22:44:19
Done.
|
+ content::WebContents* host_contents() const { return host_->host_contents(); } |
Devlin
2015/06/19 19:56:09
Let's rename these - "host_contents" and "web_cont
ltilve
2015/06/28 22:44:19
Done.
|
+ |
+ // Returns TabContents sidebar is linked to. |
+ content::WebContents* web_contents() const { return tab_; } |
+ |
+ const std::string& extension_id() { return host_->extension_id(); } |
+ |
+ // content::NotificationObserver overrides. |
Devlin
2015/06/19 19:56:09
s/ overrides./: (everywhere)
ltilve
2015/06/28 22:44:19
Done.
|
+ void Observe(int type, |
Devlin
2015/06/19 19:56:09
make this private
ltilve
2015/06/28 22:44:19
Done.
|
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) override; |
+ |
+ // TabStripModelObserver overrides. |
+ void TabClosingAt(TabStripModel* tab_strip_model, |
+ content::WebContents* contents, |
+ int index); |
+ |
+ private: |
+ scoped_ptr<extensions::ExtensionViewHost> host_; |
+ |
+ content::NotificationRegistrar registrar_; |
+ |
+ // Contents of the tab this sidebar is linked to. |
+ content::WebContents* tab_; |
+ |
+ // Reference to browser |
+ Browser* browser_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SidebarContainer); |
+}; |
+ |
+} // namespace extensions |
+#endif // CHROME_BROWSER_EXTENSIONS_SIDEBAR_CONTAINER_H_ |