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/logging.h" | 14 #include "base/logging.h" |
14 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
19 #include "base/time.h" | 20 #include "base/time.h" |
20 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 21 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
21 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/extensions/shell_window_registry.h" | 23 #include "chrome/browser/extensions/shell_window_registry.h" |
23 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 24 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 26 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
26 #include "chrome/browser/ui/autofill/data_model_wrapper.h" | 27 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
27 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
28 #include "chrome/browser/ui/browser_finder.h" | 29 #include "chrome/browser/ui/browser_finder.h" |
29 #include "chrome/browser/ui/browser_navigator.h" | 30 #include "chrome/browser/ui/browser_navigator.h" |
30 #include "chrome/browser/ui/browser_window.h" | 31 #include "chrome/browser/ui/browser_window.h" |
31 #include "chrome/browser/ui/extensions/native_app_window.h" | 32 #include "chrome/browser/ui/extensions/native_app_window.h" |
32 #include "chrome/browser/ui/extensions/shell_window.h" | |
33 #include "chrome/common/chrome_version_info.h" | 33 #include "chrome/common/chrome_version_info.h" |
34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
36 #include "components/autofill/browser/autofill_country.h" | 36 #include "components/autofill/browser/autofill_country.h" |
37 #include "components/autofill/browser/autofill_data_model.h" | 37 #include "components/autofill/browser/autofill_data_model.h" |
38 #include "components/autofill/browser/autofill_manager.h" | 38 #include "components/autofill/browser/autofill_manager.h" |
39 #include "components/autofill/browser/autofill_type.h" | 39 #include "components/autofill/browser/autofill_type.h" |
40 #include "components/autofill/browser/personal_data_manager.h" | 40 #include "components/autofill/browser/personal_data_manager.h" |
41 #include "components/autofill/browser/phone_number_i18n.h" | 41 #include "components/autofill/browser/phone_number_i18n.h" |
42 #include "components/autofill/browser/validation.h" | 42 #include "components/autofill/browser/validation.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // window might be a browser window for a Chrome tab, or it might be a shell | 210 // window might be a browser window for a Chrome tab, or it might be a shell |
211 // window for a platform app. | 211 // window for a platform app. |
212 ui::BaseWindow* GetBaseWindowForWebContents( | 212 ui::BaseWindow* GetBaseWindowForWebContents( |
213 const content::WebContents* web_contents) { | 213 const content::WebContents* web_contents) { |
214 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 214 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
215 if (browser) | 215 if (browser) |
216 return browser->window(); | 216 return browser->window(); |
217 | 217 |
218 gfx::NativeWindow native_window = | 218 gfx::NativeWindow native_window = |
219 web_contents->GetView()->GetTopLevelNativeWindow(); | 219 web_contents->GetView()->GetTopLevelNativeWindow(); |
220 ShellWindow* shell_window = | 220 apps::ShellWindow* shell_window = |
221 extensions::ShellWindowRegistry:: | 221 extensions::ShellWindowRegistry:: |
222 GetShellWindowForNativeWindowAnyProfile(native_window); | 222 GetShellWindowForNativeWindowAnyProfile(native_window); |
223 return shell_window->GetBaseWindow(); | 223 return shell_window->GetBaseWindow(); |
224 } | 224 } |
225 | 225 |
226 // Extracts the string value of a field with |type| from |output|. This is | 226 // Extracts the string value of a field with |type| from |output|. This is |
227 // useful when you only need the value of 1 input from a section of view inputs. | 227 // useful when you only need the value of 1 input from a section of view inputs. |
228 string16 GetValueForType(const DetailOutputMap& output, | 228 string16 GetValueForType(const DetailOutputMap& output, |
229 AutofillFieldType type) { | 229 AutofillFieldType type) { |
230 for (DetailOutputMap::const_iterator it = output.begin(); | 230 for (DetailOutputMap::const_iterator it = output.begin(); |
(...skipping 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3041 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; | 3041 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; |
3042 } | 3042 } |
3043 | 3043 |
3044 // Has Wallet items. | 3044 // Has Wallet items. |
3045 return has_autofill_profiles ? | 3045 return has_autofill_profiles ? |
3046 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : | 3046 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : |
3047 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; | 3047 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; |
3048 } | 3048 } |
3049 | 3049 |
3050 } // namespace autofill | 3050 } // namespace autofill |
OLD | NEW |