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

Side by Side Diff: chrome/browser/autofill/autofill_manager.cc

Issue 10919066: Use BrowserContext as key in API. Switch Autofill to use BC in place of Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to parent Created 8 years, 3 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/autofill/autofill_manager.h" 5 #include "chrome/browser/autofill/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 28 matching lines...) Expand all
39 #include "chrome/browser/api/prefs/pref_service_base.h" 39 #include "chrome/browser/api/prefs/pref_service_base.h"
40 #include "chrome/browser/profiles/profile.h" 40 #include "chrome/browser/profiles/profile.h"
41 #include "chrome/browser/sync/profile_sync_service.h" 41 #include "chrome/browser/sync/profile_sync_service.h"
42 #include "chrome/browser/sync/profile_sync_service_factory.h" 42 #include "chrome/browser/sync/profile_sync_service_factory.h"
43 #include "chrome/browser/ui/tab_contents/tab_contents.h" 43 #include "chrome/browser/ui/tab_contents/tab_contents.h"
44 #include "chrome/common/autofill_messages.h" 44 #include "chrome/common/autofill_messages.h"
45 #include "chrome/common/chrome_notification_types.h" 45 #include "chrome/common/chrome_notification_types.h"
46 #include "chrome/common/chrome_switches.h" 46 #include "chrome/common/chrome_switches.h"
47 #include "chrome/common/pref_names.h" 47 #include "chrome/common/pref_names.h"
48 #include "chrome/common/url_constants.h" 48 #include "chrome/common/url_constants.h"
49 #include "content/public/browser/browser_context.h"
49 #include "content/public/browser/browser_thread.h" 50 #include "content/public/browser/browser_thread.h"
50 #include "content/public/browser/notification_service.h" 51 #include "content/public/browser/notification_service.h"
51 #include "content/public/browser/notification_source.h" 52 #include "content/public/browser/notification_source.h"
52 #include "content/public/browser/render_view_host.h" 53 #include "content/public/browser/render_view_host.h"
53 #include "content/public/browser/web_contents.h" 54 #include "content/public/browser/web_contents.h"
54 #include "googleurl/src/gurl.h" 55 #include "googleurl/src/gurl.h"
55 #include "grit/generated_resources.h" 56 #include "grit/generated_resources.h"
56 #include "ipc/ipc_message_macros.h" 57 #include "ipc/ipc_message_macros.h"
57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" 58 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h"
58 #include "ui/base/l10n/l10n_util.h" 59 #include "ui/base/l10n/l10n_util.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 173 }
173 174
174 } // namespace 175 } // namespace
175 176
176 AutofillManager::AutofillManager(autofill::AutofillManagerDelegate* delegate, 177 AutofillManager::AutofillManager(autofill::AutofillManagerDelegate* delegate,
177 TabContents* tab_contents) 178 TabContents* tab_contents)
178 : content::WebContentsObserver(tab_contents->web_contents()), 179 : content::WebContentsObserver(tab_contents->web_contents()),
179 manager_delegate_(delegate), 180 manager_delegate_(delegate),
180 tab_contents_(tab_contents), 181 tab_contents_(tab_contents),
181 personal_data_(NULL), 182 personal_data_(NULL),
182 download_manager_(tab_contents->profile(), this), 183 download_manager_(delegate->GetBrowserContext(), this),
183 disable_download_manager_requests_(false), 184 disable_download_manager_requests_(false),
184 metric_logger_(new AutofillMetrics), 185 metric_logger_(new AutofillMetrics),
185 has_logged_autofill_enabled_(false), 186 has_logged_autofill_enabled_(false),
186 has_logged_address_suggestions_count_(false), 187 has_logged_address_suggestions_count_(false),
187 did_show_suggestions_(false), 188 did_show_suggestions_(false),
188 user_did_type_(false), 189 user_did_type_(false),
189 user_did_autofill_(false), 190 user_did_autofill_(false),
190 user_did_edit_autofilled_field_(false), 191 user_did_edit_autofilled_field_(false),
191 password_generation_enabled_(false), 192 password_generation_enabled_(false),
192 external_delegate_(NULL) { 193 external_delegate_(NULL) {
193 // |personal_data_| is NULL when using test-enabled WebContents. 194 // |personal_data_| is NULL when using test-enabled WebContents.
194 personal_data_ = PersonalDataManagerFactory::GetForProfile( 195 personal_data_ = PersonalDataManagerFactory::GetForProfile(
195 tab_contents->profile()->GetOriginalProfile()); 196 tab_contents_->profile()->GetOriginalProfile());
196 RegisterWithSyncService(); 197 RegisterWithSyncService();
197 registrar_.Init(manager_delegate_->GetPrefs()); 198 registrar_.Init(manager_delegate_->GetPrefs());
198 registrar_.Add(prefs::kPasswordGenerationEnabled, this); 199 registrar_.Add(prefs::kPasswordGenerationEnabled, this);
199 notification_registrar_.Add(this, 200 notification_registrar_.Add(this,
200 chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, 201 chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED,
201 content::Source<TabContents>(tab_contents)); 202 content::Source<TabContents>(tab_contents));
202 } 203 }
203 204
204 AutofillManager::~AutofillManager() { 205 AutofillManager::~AutofillManager() {
205 } 206 }
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 *profile_guid = IDToGUID(profile_id); 1395 *profile_guid = IDToGUID(profile_id);
1395 } 1396 }
1396 1397
1397 void AutofillManager::UpdateInitialInteractionTimestamp( 1398 void AutofillManager::UpdateInitialInteractionTimestamp(
1398 const TimeTicks& interaction_timestamp) { 1399 const TimeTicks& interaction_timestamp) {
1399 if (initial_interaction_timestamp_.is_null() || 1400 if (initial_interaction_timestamp_.is_null() ||
1400 interaction_timestamp < initial_interaction_timestamp_) { 1401 interaction_timestamp < initial_interaction_timestamp_) {
1401 initial_interaction_timestamp_ = interaction_timestamp; 1402 initial_interaction_timestamp_ = interaction_timestamp;
1402 } 1403 }
1403 } 1404 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_download.cc ('k') | chrome/browser/autofill/autofill_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698