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/proxy_config_service_impl.h" | 9 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 return std::min(screen_size, desired_size); | 32 return std::min(screen_size, desired_size); |
33 } | 33 } |
34 | 34 |
35 } // namespace | 35 } // namespace |
36 | 36 |
37 namespace chromeos { | 37 namespace chromeos { |
38 | 38 |
39 // static | 39 // static |
40 int ProxySettingsDialog::instance_count_ = 0; | 40 int ProxySettingsDialog::instance_count_ = 0; |
41 | 41 |
42 ProxySettingsDialog::ProxySettingsDialog(LoginHtmlDialog::Delegate* delegate, | 42 ProxySettingsDialog::ProxySettingsDialog(LoginWebDialog::Delegate* delegate, |
43 gfx::NativeWindow window) | 43 gfx::NativeWindow window) |
44 : LoginHtmlDialog( | 44 : LoginWebDialog( |
45 delegate, | 45 delegate, |
46 window, | 46 window, |
47 std::wstring(), | 47 std::wstring(), |
48 GURL(chrome::kChromeUIProxySettingsURL), | 48 GURL(chrome::kChromeUIProxySettingsURL), |
49 LoginHtmlDialog::STYLE_BUBBLE) { | 49 LoginWebDialog::STYLE_BUBBLE) { |
50 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 50 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
51 ++instance_count_; | 51 ++instance_count_; |
52 | 52 |
53 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); | 53 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
54 SetDialogSize(CalculateSize(screen_bounds.width(), | 54 SetDialogSize(CalculateSize(screen_bounds.width(), |
55 kProxySettingsDialogReasonableWidth, | 55 kProxySettingsDialogReasonableWidth, |
56 kProxySettingsDialogReasonableWidthRatio), | 56 kProxySettingsDialogReasonableWidthRatio), |
57 CalculateSize(screen_bounds.height(), | 57 CalculateSize(screen_bounds.height(), |
58 kProxySettingsDialogReasonableHeight, | 58 kProxySettingsDialogReasonableHeight, |
59 kProxySettingsDialogReasonableHeightRatio)); | 59 kProxySettingsDialogReasonableHeightRatio)); |
60 | 60 |
61 // Get network name for dialog title. | 61 // Get network name for dialog title. |
62 Profile* profile = ProfileManager::GetDefaultProfile(); | 62 Profile* profile = ProfileManager::GetDefaultProfile(); |
63 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); | 63 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); |
64 proxy_tracker->UIMakeActiveNetworkCurrent(); | 64 proxy_tracker->UIMakeActiveNetworkCurrent(); |
65 std::string network_name; | 65 std::string network_name; |
66 proxy_tracker->UIGetCurrentNetworkName(&network_name); | 66 proxy_tracker->UIGetCurrentNetworkName(&network_name); |
67 SetDialogTitle(l10n_util::GetStringFUTF16(IDS_PROXY_PAGE_TITLE_FORMAT, | 67 SetDialogTitle(l10n_util::GetStringFUTF16(IDS_PROXY_PAGE_TITLE_FORMAT, |
68 ASCIIToUTF16(network_name))); | 68 ASCIIToUTF16(network_name))); |
69 } | 69 } |
70 | 70 |
71 ProxySettingsDialog::~ProxySettingsDialog() { | 71 ProxySettingsDialog::~ProxySettingsDialog() { |
72 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 72 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
73 --instance_count_; | 73 --instance_count_; |
74 } | 74 } |
75 | 75 |
76 void ProxySettingsDialog::OnDialogClosed(const std::string& json_retval) { | 76 void ProxySettingsDialog::OnDialogClosed(const std::string& json_retval) { |
77 LoginHtmlDialog::OnDialogClosed(json_retval); | 77 LoginWebDialog::OnDialogClosed(json_retval); |
78 content::NotificationService::current()->Notify( | 78 content::NotificationService::current()->Notify( |
79 chrome::NOTIFICATION_LOGIN_PROXY_CHANGED, | 79 chrome::NOTIFICATION_LOGIN_PROXY_CHANGED, |
80 content::NotificationService::AllSources(), | 80 content::NotificationService::AllSources(), |
81 content::NotificationService::NoDetails()); | 81 content::NotificationService::NoDetails()); |
82 delete this; | 82 delete this; |
83 } | 83 } |
84 | 84 |
85 bool ProxySettingsDialog::IsShown() { | 85 bool ProxySettingsDialog::IsShown() { |
86 return instance_count_ > 0; | 86 return instance_count_ > 0; |
87 } | 87 } |
88 | 88 |
89 } // namespace chromeos | 89 } // namespace chromeos |
OLD | NEW |