Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: chrome/browser/chromeos/login/ui/proxy_settings_dialog.cc

Issue 983823002: Use GUID instead of servicePath in network settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_430115_internet_options_enable_extension_apis
Patch Set: Use guid instead of service_path for proxy prefs Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/proxy_settings_dialog.h" 5 #include "chrome/browser/chromeos/login/ui/proxy_settings_dialog.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/chromeos/login/helper.h" 10 #include "chrome/browser/chromeos/login/helper.h"
(...skipping 19 matching lines...) Expand all
30 const float kProxySettingsDialogReasonableHeightRatio = 0.4f; 30 const float kProxySettingsDialogReasonableHeightRatio = 0.4f;
31 31
32 const char kProxySettingsURLParam[] = "?network=%s"; 32 const char kProxySettingsURLParam[] = "?network=%s";
33 33
34 int CalculateSize(int screen_size, int min_comfortable, float desired_ratio) { 34 int CalculateSize(int screen_size, int min_comfortable, float desired_ratio) {
35 int desired_size = static_cast<int>(desired_ratio * screen_size); 35 int desired_size = static_cast<int>(desired_ratio * screen_size);
36 desired_size = std::max(min_comfortable, desired_size); 36 desired_size = std::max(min_comfortable, desired_size);
37 return std::min(screen_size, desired_size); 37 return std::min(screen_size, desired_size);
38 } 38 }
39 39
40 GURL GetURLForProxySettings(const std::string& service_path) { 40 GURL GetURLForProxySettings(const std::string& guid) {
41 std::string url(chrome::kChromeUIProxySettingsURL); 41 std::string url(chrome::kChromeUIProxySettingsURL);
42 url += base::StringPrintf( 42 url += base::StringPrintf(
43 kProxySettingsURLParam, 43 kProxySettingsURLParam,
44 net::EscapeUrlEncodedData(service_path, true).c_str()); 44 net::EscapeUrlEncodedData(guid, true).c_str());
45 return GURL(url); 45 return GURL(url);
46 } 46 }
47 47
48 } // namespace 48 } // namespace
49 49
50 namespace chromeos { 50 namespace chromeos {
51 51
52 // static 52 // static
53 int ProxySettingsDialog::instance_count_ = 0; 53 int ProxySettingsDialog::instance_count_ = 0;
54 54
55 ProxySettingsDialog::ProxySettingsDialog( 55 ProxySettingsDialog::ProxySettingsDialog(
56 content::BrowserContext* browser_context, 56 content::BrowserContext* browser_context,
57 const NetworkState& network, 57 const NetworkState& network,
58 LoginWebDialog::Delegate* delegate, 58 LoginWebDialog::Delegate* delegate,
59 gfx::NativeWindow window) 59 gfx::NativeWindow window)
60 : LoginWebDialog(browser_context, 60 : LoginWebDialog(browser_context,
61 delegate, 61 delegate,
62 window, 62 window,
63 base::string16(), 63 base::string16(),
64 GetURLForProxySettings(network.path())) { 64 GetURLForProxySettings(network.guid())) {
65 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 65 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
66 ++instance_count_; 66 ++instance_count_;
67 67
68 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); 68 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size()));
69 SetDialogSize(CalculateSize(screen_bounds.width(), 69 SetDialogSize(CalculateSize(screen_bounds.width(),
70 kProxySettingsDialogReasonableWidth, 70 kProxySettingsDialogReasonableWidth,
71 kProxySettingsDialogReasonableWidthRatio), 71 kProxySettingsDialogReasonableWidthRatio),
72 CalculateSize(screen_bounds.height(), 72 CalculateSize(screen_bounds.height(),
73 kProxySettingsDialogReasonableHeight, 73 kProxySettingsDialogReasonableHeight,
74 kProxySettingsDialogReasonableHeightRatio)); 74 kProxySettingsDialogReasonableHeightRatio));
(...skipping 19 matching lines...) Expand all
94 chrome::NOTIFICATION_LOGIN_PROXY_CHANGED, 94 chrome::NOTIFICATION_LOGIN_PROXY_CHANGED,
95 content::NotificationService::AllSources(), 95 content::NotificationService::AllSources(),
96 content::NotificationService::NoDetails()); 96 content::NotificationService::NoDetails());
97 } 97 }
98 98
99 bool ProxySettingsDialog::IsShown() { 99 bool ProxySettingsDialog::IsShown() {
100 return instance_count_ > 0; 100 return instance_count_ > 0;
101 } 101 }
102 102
103 } // namespace chromeos 103 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_delegate.cc ('k') | chrome/browser/chromeos/offline/offline_load_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698