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

Side by Side Diff: components/autofill/browser/autofill_external_delegate.cc

Issue 17225008: Eliminate AutofillExternalDelegate being a WebContentsUserData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 7 years, 6 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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "components/autofill/browser/autocomplete_history_manager.h" 6 #include "components/autofill/browser/autocomplete_history_manager.h"
7 #include "components/autofill/browser/autofill_external_delegate.h" 7 #include "components/autofill/browser/autofill_external_delegate.h"
8 #include "components/autofill/browser/autofill_manager.h" 8 #include "components/autofill/browser/autofill_manager.h"
9 #include "components/autofill/common/autofill_messages.h" 9 #include "components/autofill/common/autofill_messages.h"
10 #include "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
11 #include "content/public/browser/notification_service.h" 11 #include "content/public/browser/notification_service.h"
12 #include "content/public/browser/notification_source.h" 12 #include "content/public/browser/notification_source.h"
13 #include "content/public/browser/notification_types.h" 13 #include "content/public/browser/notification_types.h"
14 #include "content/public/browser/render_view_host.h" 14 #include "content/public/browser/render_view_host.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "grit/component_resources.h" 16 #include "grit/component_resources.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 19
20 #if defined(OS_ANDROID) 20 #if defined(OS_ANDROID)
21 #include "content/public/browser/android/content_view_core.h" 21 #include "content/public/browser/android/content_view_core.h"
22 #endif 22 #endif
23 23
24 using content::RenderViewHost; 24 using content::RenderViewHost;
25 using WebKit::WebAutofillClient; 25 using WebKit::WebAutofillClient;
26 26
27 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::AutofillExternalDelegate);
28
29 namespace autofill { 27 namespace autofill {
30 28
31 void AutofillExternalDelegate::CreateForWebContentsAndManager(
32 content::WebContents* web_contents,
33 AutofillManager* autofill_manager) {
34 if (FromWebContents(web_contents))
35 return;
36
37 web_contents->SetUserData(
38 UserDataKey(),
39 new AutofillExternalDelegate(web_contents, autofill_manager));
40 }
41
42 AutofillExternalDelegate::AutofillExternalDelegate( 29 AutofillExternalDelegate::AutofillExternalDelegate(
43 content::WebContents* web_contents, 30 content::WebContents* web_contents,
44 AutofillManager* autofill_manager) 31 AutofillManager* autofill_manager)
45 : web_contents_(web_contents), 32 : web_contents_(web_contents),
46 autofill_manager_(autofill_manager), 33 autofill_manager_(autofill_manager),
47 password_autofill_manager_(web_contents), 34 password_autofill_manager_(web_contents),
48 autofill_query_id_(0), 35 autofill_query_id_(0),
49 display_warning_if_disabled_(false), 36 display_warning_if_disabled_(false),
50 has_autofill_suggestion_(false), 37 has_autofill_suggestion_(false),
51 has_shown_autofill_popup_for_current_edit_(false), 38 has_shown_autofill_popup_for_current_edit_(false),
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (!*content::Details<bool>(details).ptr()) 381 if (!*content::Details<bool>(details).ptr())
395 autofill_manager_->delegate()->HideAutofillPopup(); 382 autofill_manager_->delegate()->HideAutofillPopup();
396 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { 383 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
397 autofill_manager_->delegate()->HideAutofillPopup(); 384 autofill_manager_->delegate()->HideAutofillPopup();
398 } else { 385 } else {
399 NOTREACHED(); 386 NOTREACHED();
400 } 387 }
401 } 388 }
402 389
403 } // namespace autofill 390 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/browser/autofill_external_delegate.h ('k') | components/autofill/content/browser/autofill_driver_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698