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

Side by Side Diff: chrome/browser/web_resource/web_resource_service.cc

Issue 6308015: Add scoped_allowio for WebResourceServiceUtil::CanShowPromo until we can eval... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/web_resource/web_resource_service.h" 5 #include "chrome/browser/web_resource/web_resource_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/threading/thread_restrictions.h"
13 #include "base/time.h" 14 #include "base/time.h"
14 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
15 #include "base/values.h" 16 #include "base/values.h"
16 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/browser_thread.h" 18 #include "chrome/browser/browser_thread.h"
18 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/platform_util.h" 20 #include "chrome/browser/platform_util.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/sync/sync_ui_util.h" 22 #include "chrome/browser/sync/sync_ui_util.h"
22 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 PrefService* prefs = profile->GetPrefs(); 552 PrefService* prefs = profile->GetPrefs();
552 if (prefs->HasPrefPath(prefs::kNTPPromoClosed)) 553 if (prefs->HasPrefPath(prefs::kNTPPromoClosed))
553 promo_closed = prefs->GetBoolean(prefs::kNTPPromoClosed); 554 promo_closed = prefs->GetBoolean(prefs::kNTPPromoClosed);
554 555
555 // Only show if not synced. 556 // Only show if not synced.
556 bool is_synced = 557 bool is_synced =
557 (profile->HasProfileSyncService() && 558 (profile->HasProfileSyncService() &&
558 sync_ui_util::GetStatus( 559 sync_ui_util::GetStatus(
559 profile->GetProfileSyncService()) == sync_ui_util::SYNCED); 560 profile->GetProfileSyncService()) == sync_ui_util::SYNCED);
560 561
562 // GetVersionStringModifier hits the registry. See http://crbug.com/70898.
563 base::ThreadRestrictions::ScopedAllowIO allow_io;
561 const std::string channel = platform_util::GetVersionStringModifier(); 564 const std::string channel = platform_util::GetVersionStringModifier();
562 bool is_promo_build = false; 565 bool is_promo_build = false;
563 if (prefs->HasPrefPath(prefs::kNTPPromoBuild)) { 566 if (prefs->HasPrefPath(prefs::kNTPPromoBuild)) {
564 int builds_allowed = prefs->GetInteger(prefs::kNTPPromoBuild); 567 int builds_allowed = prefs->GetInteger(prefs::kNTPPromoBuild);
565 if (channel == "dev") { 568 if (channel == "dev") {
566 is_promo_build = (DEV_BUILD & builds_allowed) != 0; 569 is_promo_build = (DEV_BUILD & builds_allowed) != 0;
567 } else if (channel == "beta") { 570 } else if (channel == "beta") {
568 is_promo_build = (BETA_BUILD & builds_allowed) != 0; 571 is_promo_build = (BETA_BUILD & builds_allowed) != 0;
569 } else if (channel == "stable") { 572 } else if (channel == "stable") {
570 is_promo_build = (STABLE_BUILD & builds_allowed) != 0; 573 is_promo_build = (STABLE_BUILD & builds_allowed) != 0;
571 } else { 574 } else {
572 is_promo_build = true; 575 is_promo_build = true;
573 } 576 }
574 } 577 }
575 578
576 return !promo_closed && !is_synced && is_promo_build; 579 return !promo_closed && !is_synced && is_promo_build;
577 } 580 }
578 581
579 } // namespace WebResourceService 582 } // namespace WebResourceService
580 583
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698