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

Side by Side Diff: chrome/browser/download/download_dir_policy_handler.cc

Issue 372103006: Stamp out CreateStringValue in chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/download/download_dir_policy_handler.h" 5 #include "chrome/browser/download/download_dir_policy_handler.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_value_map.h" 9 #include "base/prefs/pref_value_map.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #else 92 #else
93 expanded_value = policy::path_parser::ExpandPathVariables(string_value); 93 expanded_value = policy::path_parser::ExpandPathVariables(string_value);
94 #endif 94 #endif
95 // Make sure the path isn't empty, since that will point to an undefined 95 // Make sure the path isn't empty, since that will point to an undefined
96 // location; the default location is used instead in that case. 96 // location; the default location is used instead in that case.
97 // This is checked after path expansion because a non-empty policy value can 97 // This is checked after path expansion because a non-empty policy value can
98 // lead to an empty path value after expansion (e.g. "\"\""). 98 // lead to an empty path value after expansion (e.g. "\"\"").
99 if (expanded_value.empty()) 99 if (expanded_value.empty())
100 expanded_value = DownloadPrefs::GetDefaultDownloadDirectory().value(); 100 expanded_value = DownloadPrefs::GetDefaultDownloadDirectory().value();
101 prefs->SetValue(prefs::kDownloadDefaultDirectory, 101 prefs->SetValue(prefs::kDownloadDefaultDirectory,
102 base::Value::CreateStringValue(expanded_value)); 102 new base::StringValue(expanded_value));
103 103
104 // If the policy is mandatory, prompt for download should be disabled. 104 // If the policy is mandatory, prompt for download should be disabled.
105 // Otherwise, it would enable a user to bypass the mandatory policy. 105 // Otherwise, it would enable a user to bypass the mandatory policy.
106 if (policies.Get(policy_name())->level == policy::POLICY_LEVEL_MANDATORY) { 106 if (policies.Get(policy_name())->level == policy::POLICY_LEVEL_MANDATORY) {
107 prefs->SetValue(prefs::kPromptForDownload, 107 prefs->SetValue(prefs::kPromptForDownload,
108 new base::FundamentalValue(false)); 108 new base::FundamentalValue(false));
109 #if defined(OS_CHROMEOS) 109 #if defined(OS_CHROMEOS)
110 if (download_to_drive) { 110 if (download_to_drive) {
111 prefs->SetValue(prefs::kDisableDrive, 111 prefs->SetValue(prefs::kDisableDrive,
112 new base::FundamentalValue(false)); 112 new base::FundamentalValue(false));
113 } 113 }
114 #endif 114 #endif
115 } 115 }
116 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698