OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webui/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
25 #include "chrome/browser/sync/profile_sync_service.h" | 25 #include "chrome/browser/sync/profile_sync_service.h" |
26 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
27 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 27 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
28 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 28 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
29 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 29 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/common/net/gaia/gaia_constants.h" | 31 #include "chrome/common/net/gaia/gaia_constants.h" |
32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
33 #include "content/public/browser/render_view_host.h" | 33 #include "content/public/browser/render_view_host.h" |
34 #include "content/public/browser/render_view_host_delegate.h" | |
35 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 35 #include "content/public/browser/web_contents_delegate.h" |
36 #include "grit/chromium_strings.h" | 36 #include "grit/chromium_strings.h" |
37 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
38 #include "grit/locale_settings.h" | 38 #include "grit/locale_settings.h" |
39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
40 | 40 |
| 41 using content::WebContents; |
41 using l10n_util::GetStringFUTF16; | 42 using l10n_util::GetStringFUTF16; |
42 using l10n_util::GetStringUTF16; | 43 using l10n_util::GetStringUTF16; |
43 | 44 |
44 namespace { | 45 namespace { |
45 | 46 |
46 // A structure which contains all the configuration information for sync. | 47 // A structure which contains all the configuration information for sync. |
47 struct SyncConfigInfo { | 48 struct SyncConfigInfo { |
48 SyncConfigInfo(); | 49 SyncConfigInfo(); |
49 ~SyncConfigInfo(); | 50 ~SyncConfigInfo(); |
50 | 51 |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 service->set_setup_in_progress(true); | 951 service->set_setup_in_progress(true); |
951 service->UnsuppressAndStart(); | 952 service->UnsuppressAndStart(); |
952 DisplaySpinner(); | 953 DisplaySpinner(); |
953 } else { | 954 } else { |
954 DisplayConfigureSync(true, false); | 955 DisplayConfigureSync(true, false); |
955 } | 956 } |
956 } | 957 } |
957 | 958 |
958 void SyncSetupHandler::FocusUI() { | 959 void SyncSetupHandler::FocusUI() { |
959 DCHECK(IsActiveLogin()); | 960 DCHECK(IsActiveLogin()); |
960 web_ui()->GetWebContents()->GetRenderViewHost()->GetDelegate()->Activate(); | 961 WebContents* web_contents = web_ui()->GetWebContents(); |
| 962 web_contents->GetDelegate()->ActivateContents(web_contents); |
961 } | 963 } |
962 | 964 |
963 void SyncSetupHandler::CloseUI() { | 965 void SyncSetupHandler::CloseUI() { |
964 DCHECK(IsActiveLogin()); | 966 DCHECK(IsActiveLogin()); |
965 CloseOverlay(); | 967 CloseOverlay(); |
966 } | 968 } |
967 | 969 |
968 // Private member functions. | 970 // Private member functions. |
969 | 971 |
970 bool SyncSetupHandler::FocusExistingWizardIfPresent() { | 972 bool SyncSetupHandler::FocusExistingWizardIfPresent() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 if (i != current_profile_index && AreUserNamesEqual( | 1005 if (i != current_profile_index && AreUserNamesEqual( |
1004 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { | 1006 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { |
1005 *error_message = l10n_util::GetStringUTF16( | 1007 *error_message = l10n_util::GetStringUTF16( |
1006 IDS_SYNC_USER_NAME_IN_USE_ERROR); | 1008 IDS_SYNC_USER_NAME_IN_USE_ERROR); |
1007 return false; | 1009 return false; |
1008 } | 1010 } |
1009 } | 1011 } |
1010 | 1012 |
1011 return true; | 1013 return true; |
1012 } | 1014 } |
OLD | NEW |