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

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

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 #include "chrome/browser/tab_contents_wrapper.h"
6
7 #include "chrome/browser/password_manager/password_manager.h"
8 #include "chrome/browser/password_manager_delegate_impl.h"
9 #include "chrome/browser/tab_contents/tab_contents.h"
10
11
12 TabContentsWrapper::TabContentsWrapper(TabContents* contents)
13 : tab_contents_(contents) {
14 DCHECK(contents);
15 // Stash this in the property bag so it can be retrieved without having to
16 // go to a Browser.
17 property_accessor()->SetProperty(contents->property_bag(), this);
18 }
19
20 TabContentsWrapper::~TabContentsWrapper() {
21 // Unregister observers (TabContents outlives supporting objects).
22 tab_contents()->RemoveNavigationObserver(password_manager_.get());
23 }
24
25 PropertyAccessor<TabContentsWrapper*>* TabContentsWrapper::property_accessor() {
26 return Singleton< PropertyAccessor<TabContentsWrapper*> >::get();
27 }
28
29 PasswordManager* TabContentsWrapper::GetPasswordManager() {
30 if (!password_manager_.get()) {
31 // Create the delegate then create the manager.
32 password_manager_delegate_.reset(
33 new PasswordManagerDelegateImpl(tab_contents()));
34 password_manager_.reset(
35 new PasswordManager(password_manager_delegate_.get()));
36 // Register the manager to receive navigation notifications.
37 tab_contents()->AddNavigationObserver(password_manager_.get());
38 }
39 return password_manager_.get();
40 }
41
42 TabContentsWrapper* TabContentsWrapper::Clone() {
43 TabContents* new_contents = tab_contents()->Clone();
44 TabContentsWrapper* new_wrapper = new TabContentsWrapper(new_contents);
45 // Instantiate the passowrd manager if it has been instantiated here.
46 if (password_manager_.get())
47 new_wrapper->GetPasswordManager();
48 return new_wrapper;
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698