| 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 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "chrome/browser/password_manager/password_manager.h" | 8 #include "chrome/browser/password_manager/password_manager.h" |
| 9 #include "chrome/browser/password_manager_delegate_impl.h" | 9 #include "chrome/browser/password_manager_delegate_impl.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| 11 | 11 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 31 tab_contents()->RemoveNavigationObserver(password_manager_.get()); | 31 tab_contents()->RemoveNavigationObserver(password_manager_.get()); |
| 32 } | 32 } |
| 33 | 33 |
| 34 PropertyAccessor<TabContentsWrapper*>* TabContentsWrapper::property_accessor() { | 34 PropertyAccessor<TabContentsWrapper*>* TabContentsWrapper::property_accessor() { |
| 35 return g_tab_contents_wrapper_property_accessor.Pointer(); | 35 return g_tab_contents_wrapper_property_accessor.Pointer(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 TabContentsWrapper* TabContentsWrapper::Clone() { | 38 TabContentsWrapper* TabContentsWrapper::Clone() { |
| 39 TabContents* new_contents = tab_contents()->Clone(); | 39 TabContents* new_contents = tab_contents()->Clone(); |
| 40 TabContentsWrapper* new_wrapper = new TabContentsWrapper(new_contents); | 40 TabContentsWrapper* new_wrapper = new TabContentsWrapper(new_contents); |
| 41 // Instantiate the passowrd manager if it has been instantiated here. | 41 // Instantiate the password manager if it has been instantiated here. |
| 42 if (password_manager_.get()) | 42 if (password_manager_.get()) |
| 43 new_wrapper->GetPasswordManager(); | 43 new_wrapper->GetPasswordManager(); |
| 44 return new_wrapper; | 44 return new_wrapper; |
| 45 } | 45 } |
| 46 | 46 |
| 47 PasswordManager* TabContentsWrapper::GetPasswordManager() { | 47 PasswordManager* TabContentsWrapper::GetPasswordManager() { |
| 48 if (!password_manager_.get()) { | 48 if (!password_manager_.get()) { |
| 49 // Create the delegate then create the manager. | 49 // Create the delegate then create the manager. |
| 50 password_manager_delegate_.reset( | 50 password_manager_delegate_.reset( |
| 51 new PasswordManagerDelegateImpl(tab_contents())); | 51 new PasswordManagerDelegateImpl(tab_contents())); |
| 52 password_manager_.reset( | 52 password_manager_.reset( |
| 53 new PasswordManager(password_manager_delegate_.get())); | 53 new PasswordManager(password_manager_delegate_.get())); |
| 54 // Register the manager to receive navigation notifications. | 54 // Register the manager to receive navigation notifications. |
| 55 tab_contents()->AddNavigationObserver(password_manager_.get()); | 55 tab_contents()->AddNavigationObserver(password_manager_.get()); |
| 56 } | 56 } |
| 57 return password_manager_.get(); | 57 return password_manager_.get(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 //////////////////////////////////////////////////////////////////////////////// | 60 //////////////////////////////////////////////////////////////////////////////// |
| 61 // TabContentsWrapper, WebNavigationObserver implementation: | 61 // TabContentsWrapper, WebNavigationObserver implementation: |
| 62 | 62 |
| 63 void TabContentsWrapper::NavigateToPendingEntry() { | 63 void TabContentsWrapper::NavigateToPendingEntry() { |
| 64 GetPasswordManager(); | 64 GetPasswordManager(); |
| 65 tab_contents()->RemoveNavigationObserver(this); | 65 tab_contents()->RemoveNavigationObserver(this); |
| 66 } | 66 } |
| OLD | NEW |