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

Side by Side Diff: components/autofill/content/browser/content_autofill_driver_factory.cc

Issue 2007473004: [Autofill] Migrate ContentAutofillDriver<-->AutofillAgent IPCs to mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn, gyp, test codes all done Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/autofill/content/browser/content_autofill_driver_factory.h" 5 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "components/autofill/content/browser/content_autofill_driver.h" 11 #include "components/autofill/content/browser/content_autofill_driver.h"
12 #include "components/autofill/core/browser/autofill_client.h" 12 #include "components/autofill/core/browser/autofill_client.h"
13 #include "components/autofill/core/browser/autofill_manager.h" 13 #include "components/autofill/core/browser/autofill_manager.h"
14 #include "components/autofill/core/browser/form_structure.h" 14 #include "components/autofill/core/browser/form_structure.h"
15 #include "components/autofill/core/common/autofill_switches.h" 15 #include "components/autofill/core/common/autofill_switches.h"
16 #include "content/public/browser/navigation_handle.h" 16 #include "content/public/browser/navigation_handle.h"
17 #include "content/public/browser/render_frame_host.h" 17 #include "content/public/browser/render_frame_host.h"
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "ipc/ipc_message_macros.h"
20 19
21 namespace autofill { 20 namespace autofill {
22 21
23 const char ContentAutofillDriverFactory:: 22 const char ContentAutofillDriverFactory::
24 kContentAutofillDriverFactoryWebContentsUserDataKey[] = 23 kContentAutofillDriverFactoryWebContentsUserDataKey[] =
25 "web_contents_autofill_driver_factory"; 24 "web_contents_autofill_driver_factory";
26 25
27 ContentAutofillDriverFactory::~ContentAutofillDriverFactory() {} 26 ContentAutofillDriverFactory::~ContentAutofillDriverFactory() {}
28 27
29 // static 28 // static
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 client_(client), 87 client_(client),
89 app_locale_(app_locale), 88 app_locale_(app_locale),
90 enable_download_manager_(enable_download_manager) {} 89 enable_download_manager_(enable_download_manager) {}
91 90
92 ContentAutofillDriver* ContentAutofillDriverFactory::DriverForFrame( 91 ContentAutofillDriver* ContentAutofillDriverFactory::DriverForFrame(
93 content::RenderFrameHost* render_frame_host) { 92 content::RenderFrameHost* render_frame_host) {
94 auto mapping = frame_driver_map_.find(render_frame_host); 93 auto mapping = frame_driver_map_.find(render_frame_host);
95 return mapping == frame_driver_map_.end() ? nullptr : mapping->second.get(); 94 return mapping == frame_driver_map_.end() ? nullptr : mapping->second.get();
96 } 95 }
97 96
98 bool ContentAutofillDriverFactory::OnMessageReceived(
99 const IPC::Message& message,
100 content::RenderFrameHost* render_frame_host) {
101 return frame_driver_map_[render_frame_host]->HandleMessage(message);
102 }
103
104 void ContentAutofillDriverFactory::RenderFrameCreated( 97 void ContentAutofillDriverFactory::RenderFrameCreated(
105 content::RenderFrameHost* render_frame_host) { 98 content::RenderFrameHost* render_frame_host) {
106 auto insertion_result = 99 auto insertion_result =
107 frame_driver_map_.insert(std::make_pair(render_frame_host, nullptr)); 100 frame_driver_map_.insert(std::make_pair(render_frame_host, nullptr));
108 // This is called twice for the main frame. 101 // This is called twice for the main frame.
109 if (insertion_result.second) { // This was the first time. 102 if (insertion_result.second) { // This was the first time.
110 insertion_result.first->second = base::WrapUnique(new ContentAutofillDriver( 103 insertion_result.first->second = base::WrapUnique(new ContentAutofillDriver(
111 render_frame_host, client_, app_locale_, enable_download_manager_)); 104 render_frame_host, client_, app_locale_, enable_download_manager_));
112 } 105 }
113 } 106 }
(...skipping 14 matching lines...) Expand all
128 content::NavigationHandle* navigation_handle) { 121 content::NavigationHandle* navigation_handle) {
129 if (navigation_handle->HasCommitted()) 122 if (navigation_handle->HasCommitted())
130 client_->HideAutofillPopup(); 123 client_->HideAutofillPopup();
131 } 124 }
132 125
133 void ContentAutofillDriverFactory::WasHidden() { 126 void ContentAutofillDriverFactory::WasHidden() {
134 client_->HideAutofillPopup(); 127 client_->HideAutofillPopup();
135 } 128 }
136 129
137 } // namespace autofill 130 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698