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/chromeos/login/proxy_settings_dialog.h" | 5 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/chromeos/login/helper.h" | 8 #include "chrome/browser/chromeos/login/helper.h" |
9 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
10 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 10 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 11 #include "chrome/browser/chromeos/ui_proxy_config_service.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
16 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
19 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
20 | 21 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); | 53 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
53 SetDialogSize(CalculateSize(screen_bounds.width(), | 54 SetDialogSize(CalculateSize(screen_bounds.width(), |
54 kProxySettingsDialogReasonableWidth, | 55 kProxySettingsDialogReasonableWidth, |
55 kProxySettingsDialogReasonableWidthRatio), | 56 kProxySettingsDialogReasonableWidthRatio), |
56 CalculateSize(screen_bounds.height(), | 57 CalculateSize(screen_bounds.height(), |
57 kProxySettingsDialogReasonableHeight, | 58 kProxySettingsDialogReasonableHeight, |
58 kProxySettingsDialogReasonableHeightRatio)); | 59 kProxySettingsDialogReasonableHeightRatio)); |
59 | 60 |
60 // Get network name for dialog title. | 61 // Get network name for dialog title. |
61 Profile* profile = ProfileHelper::GetSigninProfile(); | 62 Profile* profile = ProfileHelper::GetSigninProfile(); |
62 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); | 63 UIProxyConfigService& proxy_config_service = |
63 proxy_tracker->UIMakeActiveNetworkCurrent(); | 64 profile->GetProxyConfigTracker()->GetUIService(); |
| 65 proxy_config_service.MakeActiveNetworkCurrent(); |
64 std::string network_name; | 66 std::string network_name; |
65 proxy_tracker->UIGetCurrentNetworkName(&network_name); | 67 proxy_config_service.GetCurrentNetworkName(&network_name); |
66 SetDialogTitle(l10n_util::GetStringFUTF16(IDS_PROXY_PAGE_TITLE_FORMAT, | 68 SetDialogTitle(l10n_util::GetStringFUTF16(IDS_PROXY_PAGE_TITLE_FORMAT, |
67 ASCIIToUTF16(network_name))); | 69 ASCIIToUTF16(network_name))); |
68 } | 70 } |
69 | 71 |
70 ProxySettingsDialog::~ProxySettingsDialog() { | 72 ProxySettingsDialog::~ProxySettingsDialog() { |
71 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 73 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
72 --instance_count_; | 74 --instance_count_; |
73 } | 75 } |
74 | 76 |
75 void ProxySettingsDialog::OnDialogClosed(const std::string& json_retval) { | 77 void ProxySettingsDialog::OnDialogClosed(const std::string& json_retval) { |
76 LoginWebDialog::OnDialogClosed(json_retval); | 78 LoginWebDialog::OnDialogClosed(json_retval); |
77 content::NotificationService::current()->Notify( | 79 content::NotificationService::current()->Notify( |
78 chrome::NOTIFICATION_LOGIN_PROXY_CHANGED, | 80 chrome::NOTIFICATION_LOGIN_PROXY_CHANGED, |
79 content::NotificationService::AllSources(), | 81 content::NotificationService::AllSources(), |
80 content::NotificationService::NoDetails()); | 82 content::NotificationService::NoDetails()); |
81 } | 83 } |
82 | 84 |
83 bool ProxySettingsDialog::IsShown() { | 85 bool ProxySettingsDialog::IsShown() { |
84 return instance_count_ > 0; | 86 return instance_count_ > 0; |
85 } | 87 } |
86 | 88 |
87 } // namespace chromeos | 89 } // namespace chromeos |
OLD | NEW |