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

Side by Side Diff: chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc

Issue 866523002: [Abandoned] Add Autofill to the <webview> chrome://chrome-signin page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: only allow autofill in the signin page Created 5 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/chrome_autofill_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" 5 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h"
7 6
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
9 #include "chrome/browser/favicon/favicon_tab_helper.h" 9 #include "chrome/browser/favicon/favicon_tab_helper.h"
10 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" 12 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
13 #include "chrome/browser/ui/autofill/chrome_autofill_client.h"
12 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" 14 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
13 #include "chrome/common/chrome_version_info.h" 15 #include "chrome/common/chrome_version_info.h"
16 #include "chrome/common/url_constants.h"
17 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
14 #include "components/pdf/browser/pdf_web_contents_helper.h" 18 #include "components/pdf/browser/pdf_web_contents_helper.h"
15 #include "components/renderer_context_menu/context_menu_delegate.h" 19 #include "components/renderer_context_menu/context_menu_delegate.h"
16 #include "extensions/browser/api/web_request/web_request_api.h" 20 #include "extensions/browser/api/web_request/web_request_api.h"
17 #include "extensions/browser/guest_view/web_view/web_view_constants.h" 21 #include "extensions/browser/guest_view/web_view/web_view_constants.h"
18 22
19 #if defined(ENABLE_PRINTING) 23 #if defined(ENABLE_PRINTING)
20 #if defined(ENABLE_PRINT_PREVIEW) 24 #if defined(ENABLE_PRINT_PREVIEW)
21 #include "chrome/browser/printing/print_preview_message_handler.h" 25 #include "chrome/browser/printing/print_preview_message_handler.h"
22 #include "chrome/browser/printing/print_view_manager.h" 26 #include "chrome/browser/printing/print_view_manager.h"
23 #else 27 #else
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 printing::PrintViewManager::CreateForWebContents(contents); 73 printing::PrintViewManager::CreateForWebContents(contents);
70 printing::PrintPreviewMessageHandler::CreateForWebContents(contents); 74 printing::PrintPreviewMessageHandler::CreateForWebContents(contents);
71 #else 75 #else
72 printing::PrintViewManagerBasic::CreateForWebContents(contents); 76 printing::PrintViewManagerBasic::CreateForWebContents(contents);
73 #endif // defined(ENABLE_PRINT_PREVIEW) 77 #endif // defined(ENABLE_PRINT_PREVIEW)
74 #endif // defined(ENABLE_PRINTING) 78 #endif // defined(ENABLE_PRINTING)
75 pdf::PDFWebContentsHelper::CreateForWebContentsWithClient( 79 pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
76 contents, 80 contents,
77 scoped_ptr<pdf::PDFWebContentsHelperClient>( 81 scoped_ptr<pdf::PDFWebContentsHelperClient>(
78 new ChromePDFWebContentsHelperClient())); 82 new ChromePDFWebContentsHelperClient()));
83
84 // Currently, autofill is only enabled for the Chrome sign in page.
85 // TODO(fsamuel): If this changes in the future, revisit the use of autofill
86 // in <webview>.
87 if (web_view_guest_->GetOwnerSiteURL().GetOrigin().spec() !=
88 chrome::kChromeUIChromeSigninURL) {
89 return;
90 }
91
92 autofill::ChromeAutofillClient::CreateForWebContents(contents);
93 ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient(
94 contents,
95 autofill::ChromeAutofillClient::FromWebContents(contents));
96 autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate(
97 contents,
98 autofill::ChromeAutofillClient::FromWebContents(contents),
99 g_browser_process->GetApplicationLocale(),
100 autofill::AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER);
79 } 101 }
80 102
81 void ChromeWebViewGuestDelegate::OnDidCommitProvisionalLoadForFrame( 103 void ChromeWebViewGuestDelegate::OnDidCommitProvisionalLoadForFrame(
82 bool is_main_frame) { 104 bool is_main_frame) {
83 if (is_main_frame) 105 if (is_main_frame)
84 chromevox_injected_ = false; 106 chromevox_injected_ = false;
85 } 107 }
86 108
87 void ChromeWebViewGuestDelegate::OnDidInitialize() { 109 void ChromeWebViewGuestDelegate::OnDidInitialize() {
88 #if defined(OS_CHROMEOS) 110 #if defined(OS_CHROMEOS)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { 189 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) {
168 if (details.enabled) 190 if (details.enabled)
169 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost()); 191 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost());
170 else 192 else
171 chromevox_injected_ = false; 193 chromevox_injected_ = false;
172 } 194 }
173 } 195 }
174 #endif 196 #endif
175 197
176 } // namespace extensions 198 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/chrome_autofill_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698