OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill/autofill_dialog_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "apps/shell_window.h" |
11 #include "base/base64.h" | 12 #include "base/base64.h" |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
20 #include "base/time.h" | 21 #include "base/time.h" |
21 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 22 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
22 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/extensions/shell_window_registry.h" | 24 #include "chrome/browser/extensions/shell_window_registry.h" |
24 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 25 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 27 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
27 #include "chrome/browser/ui/autofill/data_model_wrapper.h" | 28 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
28 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
29 #include "chrome/browser/ui/browser_finder.h" | 30 #include "chrome/browser/ui/browser_finder.h" |
30 #include "chrome/browser/ui/browser_navigator.h" | 31 #include "chrome/browser/ui/browser_navigator.h" |
31 #include "chrome/browser/ui/browser_window.h" | 32 #include "chrome/browser/ui/browser_window.h" |
32 #include "chrome/browser/ui/extensions/native_app_window.h" | 33 #include "chrome/browser/ui/extensions/native_app_window.h" |
33 #include "chrome/browser/ui/extensions/shell_window.h" | |
34 #include "chrome/common/chrome_version_info.h" | 34 #include "chrome/common/chrome_version_info.h" |
35 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
36 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
37 #include "components/autofill/browser/autofill_country.h" | 37 #include "components/autofill/browser/autofill_country.h" |
38 #include "components/autofill/browser/autofill_data_model.h" | 38 #include "components/autofill/browser/autofill_data_model.h" |
39 #include "components/autofill/browser/autofill_manager.h" | 39 #include "components/autofill/browser/autofill_manager.h" |
40 #include "components/autofill/browser/autofill_type.h" | 40 #include "components/autofill/browser/autofill_type.h" |
41 #include "components/autofill/browser/personal_data_manager.h" | 41 #include "components/autofill/browser/personal_data_manager.h" |
42 #include "components/autofill/browser/phone_number_i18n.h" | 42 #include "components/autofill/browser/phone_number_i18n.h" |
43 #include "components/autofill/browser/validation.h" | 43 #include "components/autofill/browser/validation.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // window might be a browser window for a Chrome tab, or it might be a shell | 218 // window might be a browser window for a Chrome tab, or it might be a shell |
219 // window for a platform app. | 219 // window for a platform app. |
220 ui::BaseWindow* GetBaseWindowForWebContents( | 220 ui::BaseWindow* GetBaseWindowForWebContents( |
221 const content::WebContents* web_contents) { | 221 const content::WebContents* web_contents) { |
222 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 222 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
223 if (browser) | 223 if (browser) |
224 return browser->window(); | 224 return browser->window(); |
225 | 225 |
226 gfx::NativeWindow native_window = | 226 gfx::NativeWindow native_window = |
227 web_contents->GetView()->GetTopLevelNativeWindow(); | 227 web_contents->GetView()->GetTopLevelNativeWindow(); |
228 ShellWindow* shell_window = | 228 apps::ShellWindow* shell_window = |
229 extensions::ShellWindowRegistry:: | 229 extensions::ShellWindowRegistry:: |
230 GetShellWindowForNativeWindowAnyProfile(native_window); | 230 GetShellWindowForNativeWindowAnyProfile(native_window); |
231 return shell_window->GetBaseWindow(); | 231 return shell_window->GetBaseWindow(); |
232 } | 232 } |
233 | 233 |
234 // Extracts the string value of a field with |type| from |output|. This is | 234 // Extracts the string value of a field with |type| from |output|. This is |
235 // useful when you only need the value of 1 input from a section of view inputs. | 235 // useful when you only need the value of 1 input from a section of view inputs. |
236 string16 GetValueForType(const DetailOutputMap& output, | 236 string16 GetValueForType(const DetailOutputMap& output, |
237 AutofillFieldType type) { | 237 AutofillFieldType type) { |
238 for (DetailOutputMap::const_iterator it = output.begin(); | 238 for (DetailOutputMap::const_iterator it = output.begin(); |
(...skipping 2861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3100 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; | 3100 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; |
3101 } | 3101 } |
3102 | 3102 |
3103 // Has Wallet items. | 3103 // Has Wallet items. |
3104 return has_autofill_profiles ? | 3104 return has_autofill_profiles ? |
3105 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : | 3105 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : |
3106 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; | 3106 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; |
3107 } | 3107 } |
3108 | 3108 |
3109 } // namespace autofill | 3109 } // namespace autofill |
OLD | NEW |