summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/plugin_selection_policy.cc
diff options
context:
space:
mode:
authorgspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 22:47:45 +0000
committergspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 22:47:45 +0000
commitbdee5e011b02b20677c28a7914cc2edf57a3c54e (patch)
tree5f7d6fa27f7d754acce069ba13327d9dcd040402 /chrome/browser/chromeos/plugin_selection_policy.cc
parentd551cdcc3c87e382d24d1912fc41c6489bb0bd40 (diff)
downloadchromium_src-bdee5e011b02b20677c28a7914cc2edf57a3c54e.zip
chromium_src-bdee5e011b02b20677c28a7914cc2edf57a3c54e.tar.gz
chromium_src-bdee5e011b02b20677c28a7914cc2edf57a3c54e.tar.bz2
Added a new case in unit test, and fixed some post-commit comments
from last review. BUG=none TEST=ran unit test. Review URL: http://codereview.chromium.org/3848001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64512 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/plugin_selection_policy.cc')
-rw-r--r--chrome/browser/chromeos/plugin_selection_policy.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/chrome/browser/chromeos/plugin_selection_policy.cc b/chrome/browser/chromeos/plugin_selection_policy.cc
index b27bc42..477965a 100644
--- a/chrome/browser/chromeos/plugin_selection_policy.cc
+++ b/chrome/browser/chromeos/plugin_selection_policy.cc
@@ -33,7 +33,8 @@ namespace chromeos {
static const char kPluginSelectionPolicyFile[] =
"/usr/share/chromeos-assets/flash/plugin_policy";
-PluginSelectionPolicy::PluginSelectionPolicy() : initialized_(false) {
+PluginSelectionPolicy::PluginSelectionPolicy()
+ : init_from_file_finished_(false) {
}
void PluginSelectionPolicy::StartInit() {
@@ -52,15 +53,13 @@ bool PluginSelectionPolicy::InitFromFile(const FilePath& policy_file) {
// This must always be called from the FILE thread.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- // Note: We're "initialized" even if loading the file fails.
- initialized_ = true;
-
string data;
// This should be a really small file, so we're OK with just
// slurping it.
if (!file_util::ReadFileToString(policy_file, &data)) {
LOG(ERROR) << "Unable to read plugin policy file \""
<< policy_file.value() << "\".";
+ init_from_file_finished_ = true;
return false;
}
@@ -81,6 +80,7 @@ bool PluginSelectionPolicy::InitFromFile(const FilePath& policy_file) {
// Has to be preceeded by a "plugin" statement.
if (last_plugin.empty()) {
LOG(ERROR) << "Plugin policy file error: 'allow' out of context.";
+ init_from_file_finished_ = true;
return false;
}
line = line.substr(6);
@@ -92,6 +92,7 @@ bool PluginSelectionPolicy::InitFromFile(const FilePath& policy_file) {
// Has to be preceeded by a "plugin" statement.
if (last_plugin.empty()) {
LOG(ERROR) << "Plugin policy file error: 'deny' out of context.";
+ init_from_file_finished_ = true;
return false;
}
line = line.substr(5);
@@ -113,6 +114,7 @@ bool PluginSelectionPolicy::InitFromFile(const FilePath& policy_file) {
policies.insert(make_pair(last_plugin, policy));
policies_.swap(policies);
+ init_from_file_finished_ = true;
return true;
}
@@ -136,7 +138,8 @@ bool PluginSelectionPolicy::IsAllowed(const GURL& url,
// initialization is complete. Right now it is guaranteed only by
// the startup order and the fact that InitFromFile runs on the FILE
// thread too.
- DCHECK(initialized_) << "Tried to check policy before policy is initialized.";
+ DCHECK(init_from_file_finished_)
+ << "Tried to check policy before policy is initialized.";
string name = path.BaseName().value();