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 "apps/app_window.h" |
12 #include "apps/shell_window_registry.h" | 12 #include "apps/app_window_registry.h" |
13 #include "apps/ui/native_app_window.h" | 13 #include "apps/ui/native_app_window.h" |
14 #include "base/base64.h" | 14 #include "base/base64.h" |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
17 #include "base/i18n/case_conversion.h" | 17 #include "base/i18n/case_conversion.h" |
18 #include "base/i18n/rtl.h" | 18 #include "base/i18n/rtl.h" |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #include "base/prefs/pref_registry_simple.h" | 20 #include "base/prefs/pref_registry_simple.h" |
21 #include "base/prefs/pref_service.h" | 21 #include "base/prefs/pref_service.h" |
22 #include "base/prefs/scoped_user_pref_update.h" | 22 #include "base/prefs/scoped_user_pref_update.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 if (card) | 248 if (card) |
249 card->SetRawInfo(type, trimmed); | 249 card->SetRawInfo(type, trimmed); |
250 } else if (profile) { | 250 } else if (profile) { |
251 profile->SetRawInfo(AutofillType(type).GetStorableType(), trimmed); | 251 profile->SetRawInfo(AutofillType(type).GetStorableType(), trimmed); |
252 } | 252 } |
253 } | 253 } |
254 } | 254 } |
255 } | 255 } |
256 | 256 |
257 // Returns the containing window for the given |web_contents|. The containing | 257 // Returns the containing window for the given |web_contents|. The containing |
258 // window might be a browser window for a Chrome tab, or it might be a shell | 258 // window might be a browser window for a Chrome tab, or it might be an app |
259 // window for a platform app. | 259 // window for a platform app. |
260 ui::BaseWindow* GetBaseWindowForWebContents( | 260 ui::BaseWindow* GetBaseWindowForWebContents( |
261 const content::WebContents* web_contents) { | 261 const content::WebContents* web_contents) { |
262 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 262 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
263 if (browser) | 263 if (browser) |
264 return browser->window(); | 264 return browser->window(); |
265 | 265 |
266 gfx::NativeWindow native_window = | 266 gfx::NativeWindow native_window = |
267 web_contents->GetView()->GetTopLevelNativeWindow(); | 267 web_contents->GetView()->GetTopLevelNativeWindow(); |
268 apps::ShellWindow* shell_window = | 268 apps::AppWindow* app_window = |
269 apps::ShellWindowRegistry:: | 269 apps::AppWindowRegistry::GetAppWindowForNativeWindowAnyProfile( |
270 GetShellWindowForNativeWindowAnyProfile(native_window); | 270 native_window); |
271 return shell_window->GetBaseWindow(); | 271 return app_window->GetBaseWindow(); |
272 } | 272 } |
273 | 273 |
274 // Returns a string descriptor for a DialogSection, for use with prefs (do not | 274 // Returns a string descriptor for a DialogSection, for use with prefs (do not |
275 // change these values). | 275 // change these values). |
276 std::string SectionToPrefString(DialogSection section) { | 276 std::string SectionToPrefString(DialogSection section) { |
277 switch (section) { | 277 switch (section) { |
278 case SECTION_CC: | 278 case SECTION_CC: |
279 return "cc"; | 279 return "cc"; |
280 | 280 |
281 case SECTION_BILLING: | 281 case SECTION_BILLING: |
(...skipping 3532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3814 view_->UpdateButtonStrip(); | 3814 view_->UpdateButtonStrip(); |
3815 } | 3815 } |
3816 | 3816 |
3817 void AutofillDialogControllerImpl::FetchWalletCookie() { | 3817 void AutofillDialogControllerImpl::FetchWalletCookie() { |
3818 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3818 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
3819 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3819 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
3820 signin_helper_->StartWalletCookieValueFetch(); | 3820 signin_helper_->StartWalletCookieValueFetch(); |
3821 } | 3821 } |
3822 | 3822 |
3823 } // namespace autofill | 3823 } // namespace autofill |
OLD | NEW |