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

Side by Side Diff: chrome/browser/media/router/media_router_feature.cc

Issue 2760403003: Remove enable_media_router. (Closed)
Patch Set: . Created 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/media/router/media_router_feature.h" 5 #include "chrome/browser/media/router/media_router_feature.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "content/public/browser/browser_context.h" 8 #include "content/public/browser/browser_context.h"
9 #include "extensions/features/features.h" 9 #include "extensions/features/features.h"
10 10
11 #if defined(ENABLE_MEDIA_ROUTER)
12 #if defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS) 11 #if defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
13 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
14 #include "components/prefs/pref_service.h" 13 #include "components/prefs/pref_service.h"
15 #include "components/user_prefs/user_prefs.h" 14 #include "components/user_prefs/user_prefs.h"
16 #endif // defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS) 15 #endif // defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
17 #endif // defined(ENABLE_MEDIA_ROUTER)
18 16
19 namespace media_router { 17 namespace media_router {
20 18
21 #if defined(ENABLE_MEDIA_ROUTER)
22 #if defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS) 19 #if defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
23 namespace { 20 namespace {
24 const PrefService::Preference* GetMediaRouterPref( 21 const PrefService::Preference* GetMediaRouterPref(
25 content::BrowserContext* context) { 22 content::BrowserContext* context) {
26 return user_prefs::UserPrefs::Get(context) 23 return user_prefs::UserPrefs::Get(context)
27 ->FindPreference(prefs::kEnableMediaRouter); 24 ->FindPreference(prefs::kEnableMediaRouter);
28 } 25 }
29 } // namespace 26 } // namespace
30 #endif // defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS) 27 #endif // defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
31 #endif // defined(ENABLE_MEDIA_ROUTER)
32 28
33 bool MediaRouterEnabled(content::BrowserContext* context) { 29 bool MediaRouterEnabled(content::BrowserContext* context) {
34 #if defined(ENABLE_MEDIA_ROUTER)
35 #if defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS) 30 #if defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
36 const PrefService::Preference* pref = GetMediaRouterPref(context); 31 const PrefService::Preference* pref = GetMediaRouterPref(context);
37 // Only use the pref value if it set from a mandatory policy. 32 // Only use the pref value if it set from a mandatory policy.
38 if (pref->IsManaged() && !pref->IsDefaultValue()) { 33 if (pref->IsManaged() && !pref->IsDefaultValue()) {
39 bool allowed = false; 34 bool allowed = false;
40 CHECK(pref->GetValue()->GetAsBoolean(&allowed)); 35 CHECK(pref->GetValue()->GetAsBoolean(&allowed));
41 return allowed; 36 return allowed;
42 } 37 }
43 return true; 38 return true;
44 #else // !(defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)) 39 #else // !(defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS))
45 return false; 40 return false;
46 #endif // defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS) 41 #endif // defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
47 #else // !defined(ENABLE_MEDIA_ROUTER)
48 return false;
49 #endif // defined(ENABLE_MEDIA_ROUTER)
50 } 42 }
51 43
52 } // namespace media_router 44 } // namespace media_router
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_component_loader.cc ('k') | chrome/browser/media/router/media_router_ui_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698