Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/browser/extensions/sidebar_container.h

Issue 1168383002: Implement sidebar support for extension action popups Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 extensions::ExtensionHostObserver,
Devlin 2015/06/10 17:25:05 You're not overriding anything from ExtensionHostO
32 public content::NotificationObserver {
33 public:
34 // Interface to implement to listen for sidebar update notification.
35
36 SidebarContainer(Browser* browser,
37 content::WebContents* tab,
38 const GURL& url);
39 ~SidebarContainer() override;
40
41 // Retruns HostContents sidebar is linked to.
42 content::WebContents* host_contents() const { return host_->host_contents(); }
43
44 // Returns TabContents sidebar is linked to.
45 content::WebContents* web_contents() const { return tab_; }
46
47 // Notifies hosting window that this sidebar was expanded.
48 void Show();
49
50 // Notifies hosting window that this sidebar was expanded.
51 void Expand();
52
53 // Navigates sidebar contents|.
54 void Navigate();
55
56 const std::string& extension_id() { return host_->extension_id(); }
57
58 // content::NotificationObserver overrides.
59 void Observe(int type,
60 const content::NotificationSource& source,
61 const content::NotificationDetails& details) override;
62
63 private:
64 scoped_ptr<extensions::ExtensionViewHost> host_;
65
66 ScopedObserver<extensions::ExtensionHost, extensions::ExtensionHostObserver>
67 host_observer_;
68
69 content::NotificationRegistrar registrar_;
70
71 // Contents of the tab this sidebar is linked to.
72 content::WebContents* tab_;
73
74 // On the first expand sidebar will be automatically navigated to the default
75 // page (specified in the extension manifest), but only if the extension has
76 // not explicitly navigated it yet. This variable is set to false on the first
77 // sidebar navigation.
78 bool navigate_to_default_page_on_expand_;
79
80 DISALLOW_COPY_AND_ASSIGN(SidebarContainer);
81 };
82
83 } // namespace extensions
84 #endif // CHROME_BROWSER_EXTENSIONS_SIDEBAR_CONTAINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698