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

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

Issue 13633003: Part of multiprofile implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Little cleanup. Created 7 years, 8 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 (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/proxy_config_service_impl.h" 10 #include "chrome/browser/chromeos/proxy_config_service_impl.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/common/chrome_notification_types.h" 12 #include "chrome/common/chrome_notification_types.h"
13 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/notification_service.h" 15 #include "content/public/browser/notification_service.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
19 #include "ui/gfx/size.h" 19 #include "ui/gfx/size.h"
20 20
21 namespace { 21 namespace {
(...skipping 29 matching lines...) Expand all
51 51
52 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); 52 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size()));
53 SetDialogSize(CalculateSize(screen_bounds.width(), 53 SetDialogSize(CalculateSize(screen_bounds.width(),
54 kProxySettingsDialogReasonableWidth, 54 kProxySettingsDialogReasonableWidth,
55 kProxySettingsDialogReasonableWidthRatio), 55 kProxySettingsDialogReasonableWidthRatio),
56 CalculateSize(screen_bounds.height(), 56 CalculateSize(screen_bounds.height(),
57 kProxySettingsDialogReasonableHeight, 57 kProxySettingsDialogReasonableHeight,
58 kProxySettingsDialogReasonableHeightRatio)); 58 kProxySettingsDialogReasonableHeightRatio));
59 59
60 // Get network name for dialog title. 60 // Get network name for dialog title.
61 Profile* profile = ProfileManager::GetDefaultProfile(); 61 Profile* profile = ProfileHelper::GetSigninProfile();
62 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker(); 62 PrefProxyConfigTracker* proxy_tracker = profile->GetProxyConfigTracker();
63 proxy_tracker->UIMakeActiveNetworkCurrent(); 63 proxy_tracker->UIMakeActiveNetworkCurrent();
64 std::string network_name; 64 std::string network_name;
65 proxy_tracker->UIGetCurrentNetworkName(&network_name); 65 proxy_tracker->UIGetCurrentNetworkName(&network_name);
66 SetDialogTitle(l10n_util::GetStringFUTF16(IDS_PROXY_PAGE_TITLE_FORMAT, 66 SetDialogTitle(l10n_util::GetStringFUTF16(IDS_PROXY_PAGE_TITLE_FORMAT,
67 ASCIIToUTF16(network_name))); 67 ASCIIToUTF16(network_name)));
68 } 68 }
69 69
70 ProxySettingsDialog::~ProxySettingsDialog() { 70 ProxySettingsDialog::~ProxySettingsDialog() {
71 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 71 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
72 --instance_count_; 72 --instance_count_;
73 } 73 }
74 74
75 void ProxySettingsDialog::OnDialogClosed(const std::string& json_retval) { 75 void ProxySettingsDialog::OnDialogClosed(const std::string& json_retval) {
76 LoginWebDialog::OnDialogClosed(json_retval); 76 LoginWebDialog::OnDialogClosed(json_retval);
77 content::NotificationService::current()->Notify( 77 content::NotificationService::current()->Notify(
78 chrome::NOTIFICATION_LOGIN_PROXY_CHANGED, 78 chrome::NOTIFICATION_LOGIN_PROXY_CHANGED,
79 content::NotificationService::AllSources(), 79 content::NotificationService::AllSources(),
80 content::NotificationService::NoDetails()); 80 content::NotificationService::NoDetails());
81 } 81 }
82 82
83 bool ProxySettingsDialog::IsShown() { 83 bool ProxySettingsDialog::IsShown() {
84 return instance_count_ > 0; 84 return instance_count_ > 0;
85 } 85 }
86 86
87 } // namespace chromeos 87 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698