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

Side by Side Diff: chrome/browser/chromeos/net/network_pref_state_observer.cc

Issue 2446893008: NetworkHandler: Add ui_proxy_config_service (Closed)
Patch Set: More Feedback, reduce churn. Created 4 years, 1 month 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/net/network_pref_state_observer.h"
6
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chromeos/network/network_handler.h"
11 #include "content/public/browser/notification_service.h"
12
13 namespace chromeos {
14
15 NetworkPrefStateObserver::NetworkPrefStateObserver() {
16 // Initialize NetworkHandlwer with device prefs only.
emaxx 2016/11/02 18:18:05 nit: s/NetworkHandlwer/NetworkHandler/
stevenjb 2016/11/02 19:47:33 Done.
17 InitializeNetworkPrefServices(nullptr /* profile */);
18
19 notification_registrar_.Add(this,
20 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
emaxx 2016/11/02 18:18:05 Isn't the usage of NotificationType discouraged in
stevenjb 2016/11/02 19:47:33 I am not aware of any alternative, and we rely on
21 content::NotificationService::AllSources());
22 }
23
24 NetworkPrefStateObserver::~NetworkPrefStateObserver() {}
25
26 void NetworkPrefStateObserver::Observe(
27 int type,
28 const content::NotificationSource& source,
29 const content::NotificationDetails& details) {
30 DCHECK_EQ(chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, type);
31 Profile* profile = content::Details<Profile>(details).ptr();
32 DCHECK(profile);
33 InitializeNetworkPrefServices(profile);
34 }
35
36 void NetworkPrefStateObserver::InitializeNetworkPrefServices(Profile* profile) {
37 DCHECK(g_browser_process);
38 NetworkHandler::Get()->InitializePrefServices(
39 profile ? profile->GetPrefs() : nullptr,
40 g_browser_process->local_state());
41 }
42
43 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698