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

Side by Side Diff: chrome/browser/apps/drive/drive_app_mapping.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | chrome/browser/banners/app_banner_settings_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/apps/drive/drive_app_mapping.h" 5 #include "chrome/browser/apps/drive/drive_app_mapping.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 std::string DriveAppMapping::GetDriveApp( 79 std::string DriveAppMapping::GetDriveApp(
80 const std::string& chrome_app_id) const { 80 const std::string& chrome_app_id) const {
81 const base::DictionaryValue* mapping = 81 const base::DictionaryValue* mapping =
82 prefs_->GetDictionary(prefs::kAppLauncherDriveAppMapping); 82 prefs_->GetDictionary(prefs::kAppLauncherDriveAppMapping);
83 for (base::DictionaryValue::Iterator it(*mapping); !it.IsAtEnd(); 83 for (base::DictionaryValue::Iterator it(*mapping); !it.IsAtEnd();
84 it.Advance()) { 84 it.Advance()) {
85 const base::DictionaryValue* info_dict; 85 const base::DictionaryValue* info_dict;
86 std::string value_string; 86 std::string value_string;
87 DCHECK(it.value().IsType(base::Value::TYPE_DICTIONARY)); 87 DCHECK(it.value().IsType(base::Value::Type::DICTIONARY));
88 if (it.value().GetAsDictionary(&info_dict) && 88 if (it.value().GetAsDictionary(&info_dict) &&
89 info_dict->GetStringWithoutPathExpansion(kKeyChromeApp, 89 info_dict->GetStringWithoutPathExpansion(kKeyChromeApp,
90 &value_string) && 90 &value_string) &&
91 value_string == chrome_app_id) { 91 value_string == chrome_app_id) {
92 return it.key(); 92 return it.key();
93 } 93 }
94 } 94 }
95 return std::string(); 95 return std::string();
96 } 96 }
97 97
98 bool DriveAppMapping::IsChromeAppGenerated( 98 bool DriveAppMapping::IsChromeAppGenerated(
99 const std::string& chrome_app_id) const { 99 const std::string& chrome_app_id) const {
100 const base::DictionaryValue* mapping = 100 const base::DictionaryValue* mapping =
101 prefs_->GetDictionary(prefs::kAppLauncherDriveAppMapping); 101 prefs_->GetDictionary(prefs::kAppLauncherDriveAppMapping);
102 for (base::DictionaryValue::Iterator it(*mapping); !it.IsAtEnd(); 102 for (base::DictionaryValue::Iterator it(*mapping); !it.IsAtEnd();
103 it.Advance()) { 103 it.Advance()) {
104 const base::DictionaryValue* info_dict; 104 const base::DictionaryValue* info_dict;
105 std::string value_string; 105 std::string value_string;
106 bool generated = false; 106 bool generated = false;
107 DCHECK(it.value().IsType(base::Value::TYPE_DICTIONARY)); 107 DCHECK(it.value().IsType(base::Value::Type::DICTIONARY));
108 if (it.value().GetAsDictionary(&info_dict) && 108 if (it.value().GetAsDictionary(&info_dict) &&
109 info_dict->GetStringWithoutPathExpansion(kKeyChromeApp, 109 info_dict->GetStringWithoutPathExpansion(kKeyChromeApp,
110 &value_string) && 110 &value_string) &&
111 value_string == chrome_app_id && 111 value_string == chrome_app_id &&
112 info_dict->GetBooleanWithoutPathExpansion(kKeyGenerated, &generated)) { 112 info_dict->GetBooleanWithoutPathExpansion(kKeyGenerated, &generated)) {
113 return generated; 113 return generated;
114 } 114 }
115 } 115 }
116 116
117 return false; 117 return false;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 uninstalled_app_ids_.insert(app_id); 160 uninstalled_app_ids_.insert(app_id);
161 } 161 }
162 } 162 }
163 163
164 void DriveAppMapping::UpdateUninstalledList() { 164 void DriveAppMapping::UpdateUninstalledList() {
165 ListPrefUpdate update(prefs_, prefs::kAppLauncherUninstalledDriveApps); 165 ListPrefUpdate update(prefs_, prefs::kAppLauncherUninstalledDriveApps);
166 update->Clear(); 166 update->Clear();
167 for (const auto& app_id : uninstalled_app_ids_) 167 for (const auto& app_id : uninstalled_app_ids_)
168 update->AppendString(app_id); 168 update->AppendString(app_id);
169 } 169 }
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | chrome/browser/banners/app_banner_settings_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698