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

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: Add sidebar handling logic and browser_tests 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 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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698