OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ | 5 #ifndef CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ |
6 #define CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ | 6 #define CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/compiler_specific.h" |
10 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
11 #include "chrome/browser/tab_contents/web_navigation_observer.h" | 12 #include "chrome/browser/tab_contents/web_navigation_observer.h" |
12 | 13 |
13 class Extension; | 14 class Extension; |
14 class NavigationController; | 15 class NavigationController; |
15 class PasswordManager; | 16 class PasswordManager; |
16 class PasswordManagerDelegate; | 17 class PasswordManagerDelegate; |
17 class TabContentsDelegate; | 18 class TabContentsDelegate; |
18 | 19 |
19 // Wraps TabContents and all of its supporting objetcs in order to control | 20 // Wraps TabContents and all of its supporting objects in order to control |
20 // their ownership and lifetime, while allowing TabContents to remain generic | 21 // their ownership and lifetime, while allowing TabContents to remain generic |
21 // and re-usable in other projects. | 22 // and re-usable in other projects. |
22 // TODO(pinkerton): Eventually, this class will become TabContents as far as | 23 // TODO(pinkerton): Eventually, this class will become TabContents as far as |
23 // the browser front-end is concerned, and the current TabContents will be | 24 // the browser front-end is concerned, and the current TabContents will be |
24 // renamed to something like WebPage or WebView (ben's suggestions). | 25 // renamed to something like WebPage or WebView (ben's suggestions). |
25 class TabContentsWrapper : public WebNavigationObserver { | 26 class TabContentsWrapper : public WebNavigationObserver { |
26 public: | 27 public: |
27 // Takes ownership of |contents|, which must be heap-allocated (as it lives | 28 // Takes ownership of |contents|, which must be heap-allocated (as it lives |
28 // in a scoped_ptr) and can not be NULL. | 29 // in a scoped_ptr) and can not be NULL. |
29 explicit TabContentsWrapper(TabContents* contents); | 30 explicit TabContentsWrapper(TabContents* contents); |
(...skipping 25 matching lines...) Expand all Loading... |
55 } | 56 } |
56 const Extension* extension_app() const { | 57 const Extension* extension_app() const { |
57 return tab_contents()->extension_app(); | 58 return tab_contents()->extension_app(); |
58 } | 59 } |
59 bool is_app() const { return tab_contents()->is_app(); } | 60 bool is_app() const { return tab_contents()->is_app(); } |
60 | 61 |
61 // Returns the PasswordManager, creating it if necessary. | 62 // Returns the PasswordManager, creating it if necessary. |
62 PasswordManager* GetPasswordManager(); | 63 PasswordManager* GetPasswordManager(); |
63 | 64 |
64 // WebNavigationObserver overrides: | 65 // WebNavigationObserver overrides: |
65 virtual void NavigateToPendingEntry(); | 66 virtual void NavigateToPendingEntry() OVERRIDE; |
66 | 67 |
67 private: | 68 private: |
68 // PasswordManager and its delegate, lazily created. The delegate must | 69 // PasswordManager and its delegate, lazily created. The delegate must |
69 // outlive the manager, per documentation in password_manager.h. | 70 // outlive the manager, per documentation in password_manager.h. |
70 scoped_ptr<PasswordManagerDelegate> password_manager_delegate_; | 71 scoped_ptr<PasswordManagerDelegate> password_manager_delegate_; |
71 scoped_ptr<PasswordManager> password_manager_; | 72 scoped_ptr<PasswordManager> password_manager_; |
72 | 73 |
73 // The supporting objects need to outlive the TabContents dtor (as they may | 74 // The supporting objects need to outlive the TabContents dtor (as they may |
74 // be called upon during its execution). As a result, this must come last | 75 // be called upon during its execution). As a result, this must come last |
75 // in the list. | 76 // in the list. |
76 scoped_ptr<TabContents> tab_contents_; | 77 scoped_ptr<TabContents> tab_contents_; |
77 }; | 78 }; |
78 | 79 |
79 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ | 80 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ |
OLD | NEW |