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

Unified Diff: chrome/browser/policy/config_dir_policy_loader.cc

Issue 10693022: Add support for loading user cloud policy on desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed redundant #ifdef OS_CHROMEOS guard Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/config_dir_policy_loader.cc
diff --git a/chrome/browser/policy/config_dir_policy_loader.cc b/chrome/browser/policy/config_dir_policy_loader.cc
index 4e83229db6a7d75f1f607b28ced1576e4542f052..82495a4bebf5d679a0ee08cd24c8c0069c1e75ee 100644
--- a/chrome/browser/policy/config_dir_policy_loader.cc
+++ b/chrome/browser/policy/config_dir_policy_loader.cc
@@ -13,9 +13,11 @@
#include "base/file_util.h"
#include "base/json/json_file_value_serializer.h"
#include "base/logging.h"
+#include "base/message_loop.h"
#include "base/platform_file.h"
#include "base/stl_util.h"
#include "chrome/browser/policy/policy_bundle.h"
+#include "content/public/browser/browser_thread.h"
namespace policy {
@@ -36,6 +38,13 @@ ConfigDirPolicyLoader::ConfigDirPolicyLoader(const FilePath& config_dir,
ConfigDirPolicyLoader::~ConfigDirPolicyLoader() {}
void ConfigDirPolicyLoader::InitOnFile() {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
+ // Some unit tests create a File thread that shares a MessageLoop with the
+ // UI thread, and this causes DCHECKs because IO operations aren't allowed on
+ // that thread. So if this is running in the context of one of those tests,
+ // just exit.
+ if (!MessageLoop::current()->IsType(MessageLoop::TYPE_IO))
+ return;
base::files::FilePathWatcher::Callback callback =
base::Bind(&ConfigDirPolicyLoader::OnFileUpdated, base::Unretained(this));
mandatory_watcher_.Watch(config_dir_.Append(kMandatoryConfigDir), callback);

Powered by Google App Engine
This is Rietveld 408576698