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

Side by Side Diff: chrome/browser/tab_contents_wrapper.h

Issue 4694008: Make pink's TabContentsWrapper change compile on Windows.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 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_TAB_CONTENTS_WRAPPER_H_
6 #define CHROME_BROWSER_TAB_CONTENTS_WRAPPER_H_
7 #pragma once
8
9 #include "base/scoped_ptr.h"
10 #include "chrome/browser/tab_contents/tab_contents.h"
11
12 class Extension;
13 class NavigationController;
14 class PasswordManager;
15 class PasswordManagerDelegate;
16 class TabContentsDelegate;
17
18 // Wraps TabContents and all of its supporting objetcs in order to control
19 // their ownership and lifetime, while allowing TabContents to remain generic
20 // and re-usable in other projects.
21 // TODO(pinkerton): Eventually, this class will become TabContents as far as
22 // the browser front-end is concerned, and the current TabContents will be
23 // renamed to something like WebPage or WebView (ben's suggestions).
24 class TabContentsWrapper {
25 public:
26 // Takes ownership of |contents|, which must be heap-allocated (as it lives
27 // in a scoped_ptr) and can not be NULL.
28 explicit TabContentsWrapper(TabContents* contents);
29 ~TabContentsWrapper();
30
31 // Used to retrieve this object from |tab_contents_|, which is placed in
32 // its property bag to avoid adding additional interfaces.
33 static PropertyAccessor<TabContentsWrapper*>* property_accessor();
34
35 // Create a TabContentsWrapper with the same state as this one. The returned
36 // heap-allocated pointer is owned by the caller.
37 TabContentsWrapper* Clone();
38
39 TabContents* tab_contents() const { return tab_contents_.get(); }
40 NavigationController& controller() const {
41 return tab_contents()->controller();
42 }
43 TabContentsView* view() const { return tab_contents()->view(); }
44 RenderViewHost* render_view_host() const {
45 return tab_contents()->render_view_host();
46 }
47 Profile* profile() const { return tab_contents()->profile(); }
48 TabContentsDelegate* delegate() const { return tab_contents()->delegate(); }
49 void set_delegate(TabContentsDelegate* d) { tab_contents()->set_delegate(d); }
50
51 // Convenience methods until extensions are removed from TabContents.
52 void SetExtensionAppById(const std::string& extension_app_id) {
53 tab_contents()->SetExtensionAppById(extension_app_id);
54 }
55 const Extension* extension_app() const {
56 return tab_contents()->extension_app();
57 }
58 bool is_app() const { return tab_contents()->is_app(); }
59
60 // Returns the PasswordManager, creating it if necessary.
61 PasswordManager* GetPasswordManager();
62
63 private:
64 // PasswordManager and its delegate, lazily created. The delegate must
65 // outlive the manager, per documentation in password_manager.h.
66 scoped_ptr<PasswordManagerDelegate> password_manager_delegate_;
67 scoped_ptr<PasswordManager> password_manager_;
68
69 // The supporting objects need to outlive the TabContents dtor (as they may
70 // be called upon during its execution). As a result, this must come last
71 // in the list.
72 scoped_ptr<TabContents> tab_contents_;
73 };
74
75 #endif // CHROME_BROWSER_TAB_CONTENTS_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698