OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "chrome/browser/autocomplete_history_manager.h" | 9 #include "chrome/browser/autocomplete_history_manager.h" |
10 #include "chrome/browser/autofill/autofill_external_delegate.h" | 10 #include "chrome/browser/autofill/autofill_external_delegate.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 //////////////////////////////////////////////////////////////////////////////// | 61 //////////////////////////////////////////////////////////////////////////////// |
62 // TabContentsWrapper, public: | 62 // TabContentsWrapper, public: |
63 | 63 |
64 TabContentsWrapper::TabContentsWrapper(WebContents* contents) | 64 TabContentsWrapper::TabContentsWrapper(WebContents* contents) |
65 : content::WebContentsObserver(contents), | 65 : content::WebContentsObserver(contents), |
66 in_destructor_(false), | 66 in_destructor_(false), |
67 web_contents_(contents) { | 67 web_contents_(contents) { |
68 DCHECK(contents); | 68 DCHECK(contents); |
69 DCHECK(!GetCurrentWrapperForContents(contents)); | 69 DCHECK(!GetCurrentWrapperForContents(contents)); |
70 | 70 |
71 web_contents_->SetViewType(chrome::VIEW_TYPE_TAB_CONTENTS); | 71 chrome::SetViewType(contents, chrome::VIEW_TYPE_TAB_CONTENTS); |
72 | 72 |
73 // Stash this in the property bag so it can be retrieved without having to | 73 // Stash this in the property bag so it can be retrieved without having to |
74 // go to a Browser. | 74 // go to a Browser. |
75 property_accessor()->SetProperty(contents->GetPropertyBag(), this); | 75 property_accessor()->SetProperty(contents->GetPropertyBag(), this); |
76 | 76 |
77 // Create the tab helpers. | 77 // Create the tab helpers. |
78 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents)); | 78 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents)); |
79 autofill_manager_ = new AutofillManager(this); | 79 autofill_manager_ = new AutofillManager(this); |
80 if (CommandLine::ForCurrentProcess()->HasSwitch( | 80 if (CommandLine::ForCurrentProcess()->HasSwitch( |
81 switches::kExternalAutofillPopup)) { | 81 switches::kExternalAutofillPopup)) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 //////////////////////////////////////////////////////////////////////////////// | 207 //////////////////////////////////////////////////////////////////////////////// |
208 // WebContentsObserver overrides | 208 // WebContentsObserver overrides |
209 | 209 |
210 void TabContentsWrapper::WebContentsDestroyed(WebContents* tab) { | 210 void TabContentsWrapper::WebContentsDestroyed(WebContents* tab) { |
211 // Destruction of the WebContents should only be done by us from our | 211 // Destruction of the WebContents should only be done by us from our |
212 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 212 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
213 // will attempt to access the WebContents and we'll crash. | 213 // will attempt to access the WebContents and we'll crash. |
214 DCHECK(in_destructor_); | 214 DCHECK(in_destructor_); |
215 } | 215 } |
OLD | NEW |