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

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

Issue 10387110: Remove VIEW_TYPE_WEB_CONTENTS and make default view type INVALID. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blah Created 8 years, 7 months 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
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 28 matching lines...) Expand all
39 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" 39 #include "chrome/browser/ui/intents/web_intent_picker_controller.h"
40 #include "chrome/browser/ui/pdf/pdf_tab_observer.h" 40 #include "chrome/browser/ui/pdf/pdf_tab_observer.h"
41 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 41 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
42 #include "chrome/browser/ui/sad_tab_helper.h" 42 #include "chrome/browser/ui/sad_tab_helper.h"
43 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" 43 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
44 #include "chrome/browser/ui/snapshot_tab_helper.h" 44 #include "chrome/browser/ui/snapshot_tab_helper.h"
45 #include "chrome/browser/ui/sync/one_click_signin_helper.h" 45 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
46 #include "chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.h" 46 #include "chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.h"
47 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 47 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
48 #include "chrome/common/chrome_switches.h" 48 #include "chrome/common/chrome_switches.h"
49 #include "chrome/common/chrome_view_type.h"
49 #include "content/public/browser/web_contents.h" 50 #include "content/public/browser/web_contents.h"
50 51
51 using content::WebContents; 52 using content::WebContents;
52 53
53 namespace { 54 namespace {
54 55
55 static base::LazyInstance<base::PropertyAccessor<TabContentsWrapper*> > 56 static base::LazyInstance<base::PropertyAccessor<TabContentsWrapper*> >
56 g_tab_contents_wrapper_property_accessor = LAZY_INSTANCE_INITIALIZER; 57 g_tab_contents_wrapper_property_accessor = LAZY_INSTANCE_INITIALIZER;
57 58
58 } // namespace 59 } // namespace
59 60
60 //////////////////////////////////////////////////////////////////////////////// 61 ////////////////////////////////////////////////////////////////////////////////
61 // TabContentsWrapper, public: 62 // TabContentsWrapper, public:
62 63
63 TabContentsWrapper::TabContentsWrapper(WebContents* contents) 64 TabContentsWrapper::TabContentsWrapper(WebContents* contents)
64 : content::WebContentsObserver(contents), 65 : content::WebContentsObserver(contents),
65 in_destructor_(false), 66 in_destructor_(false),
66 web_contents_(contents) { 67 web_contents_(contents) {
67 DCHECK(contents); 68 DCHECK(contents);
68 DCHECK(!GetCurrentWrapperForContents(contents)); 69 DCHECK(!GetCurrentWrapperForContents(contents));
69 70
71 web_contents_->SetViewType(chrome::VIEW_TYPE_TAB_CONTENTS);
72
70 // 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
71 // go to a Browser. 74 // go to a Browser.
72 property_accessor()->SetProperty(contents->GetPropertyBag(), this); 75 property_accessor()->SetProperty(contents->GetPropertyBag(), this);
73 76
74 // Create the tab helpers. 77 // Create the tab helpers.
75 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents)); 78 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents));
76 autofill_manager_ = new AutofillManager(this); 79 autofill_manager_ = new AutofillManager(this);
77 if (CommandLine::ForCurrentProcess()->HasSwitch( 80 if (CommandLine::ForCurrentProcess()->HasSwitch(
78 switches::kExternalAutofillPopup)) { 81 switches::kExternalAutofillPopup)) {
79 autofill_external_delegate_.reset( 82 autofill_external_delegate_.reset(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 209
207 //////////////////////////////////////////////////////////////////////////////// 210 ////////////////////////////////////////////////////////////////////////////////
208 // WebContentsObserver overrides 211 // WebContentsObserver overrides
209 212
210 void TabContentsWrapper::WebContentsDestroyed(WebContents* tab) { 213 void TabContentsWrapper::WebContentsDestroyed(WebContents* tab) {
211 // Destruction of the WebContents should only be done by us from our 214 // 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) 215 // 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. 216 // will attempt to access the WebContents and we'll crash.
214 DCHECK(in_destructor_); 217 DCHECK(in_destructor_);
215 } 218 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager_resource_providers.cc ('k') | chrome/common/chrome_view_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698