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

Unified Diff: chrome/browser/extensions/api/processes/processes_api.cc

Issue 16915006: Convert most of extensions and some other random stuff to using the base namespace for Values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/extensions/api/processes/processes_api.cc
diff --git a/chrome/browser/extensions/api/processes/processes_api.cc b/chrome/browser/extensions/api/processes/processes_api.cc
index adcd39d35906070441286cecf4ca5d82dfd705dc..567f5f1caff7ee5cdc6fedde0965c9b6d8e7aaae 100644
--- a/chrome/browser/extensions/api/processes/processes_api.cc
+++ b/chrome/browser/extensions/api/processes/processes_api.cc
@@ -44,16 +44,16 @@ namespace {
#if defined(ENABLE_TASK_MANAGER)
-DictionaryValue* CreateCacheData(
+base::DictionaryValue* CreateCacheData(
const WebKit::WebCache::ResourceTypeStat& stat) {
- DictionaryValue* cache = new DictionaryValue();
+ base::DictionaryValue* cache = new base::DictionaryValue();
cache->SetDouble(keys::kCacheSize, static_cast<double>(stat.size));
cache->SetDouble(keys::kCacheLiveSize, static_cast<double>(stat.liveSize));
return cache;
}
-void SetProcessType(DictionaryValue* result,
+void SetProcessType(base::DictionaryValue* result,
TaskManagerModel* model,
int index) {
// Determine process type.
@@ -99,8 +99,8 @@ void SetProcessType(DictionaryValue* result,
result->SetString(keys::kTypeKey, type);
}
-ListValue* GetTabsForProcess(int process_id) {
- ListValue* tabs_list = new ListValue();
+base::ListValue* GetTabsForProcess(int process_id) {
+ base::ListValue* tabs_list = new base::ListValue();
// The tabs list only makes sense for render processes, so if we don't find
// one, just return the empty list.
@@ -137,11 +137,11 @@ ListValue* GetTabsForProcess(int process_id) {
// This function creates a Process object to be returned to the extensions
// using these APIs. For memory details, which are not added by this function,
// the callers need to use AddMemoryDetails.
-DictionaryValue* CreateProcessFromModel(int process_id,
- TaskManagerModel* model,
- int index,
- bool include_optional) {
- DictionaryValue* result = new DictionaryValue();
+base::DictionaryValue* CreateProcessFromModel(int process_id,
+ TaskManagerModel* model,
+ int index,
+ bool include_optional) {
+ base::DictionaryValue* result = new base::DictionaryValue();
size_t mem;
result->SetInteger(keys::kIdKey, process_id);
@@ -200,7 +200,7 @@ DictionaryValue* CreateProcessFromModel(int process_id,
// Since memory details are expensive to gather, we don't do it by default.
// This function is a helper to add memory details data to an existing
// Process object representation.
-void AddMemoryDetails(DictionaryValue* result,
+void AddMemoryDetails(base::DictionaryValue* result,
TaskManagerModel* model,
int index) {
size_t mem;
@@ -307,8 +307,8 @@ void ProcessesEventRouter::OnItemsAdded(int start, int length) {
index = model_->GetGroupIndexForResource(start);
}
- scoped_ptr<ListValue> args(new ListValue());
- DictionaryValue* process = CreateProcessFromModel(
+ scoped_ptr<base::ListValue> args(new base::ListValue());
+ base::DictionaryValue* process = CreateProcessFromModel(
model_->GetUniqueChildProcessId(index), model_, index, false);
DCHECK(process != NULL);
@@ -339,21 +339,21 @@ void ProcessesEventRouter::OnItemsChanged(int start, int length) {
DCHECK(updated || updated_memory);
- IDMap<DictionaryValue> processes_map;
+ IDMap<base::DictionaryValue> processes_map;
for (int i = start; i < start + length; i++) {
if (model_->IsResourceFirstInGroup(i)) {
int id = model_->GetUniqueChildProcessId(i);
- DictionaryValue* process = CreateProcessFromModel(id, model_, i, true);
+ base::DictionaryValue* process = CreateProcessFromModel(id, model_, i, true);
processes_map.AddWithID(process, i);
}
}
int id;
std::string idkey(keys::kIdKey);
- DictionaryValue* processes = new DictionaryValue();
+ base::DictionaryValue* processes = new base::DictionaryValue();
if (updated) {
- IDMap<DictionaryValue>::iterator it(&processes_map);
+ IDMap<base::DictionaryValue>::iterator it(&processes_map);
for (; !it.IsAtEnd(); it.Advance()) {
if (!it.GetCurrentValue()->GetInteger(idkey, &id))
continue;
@@ -362,13 +362,13 @@ void ProcessesEventRouter::OnItemsChanged(int start, int length) {
processes->Set(base::IntToString(id), it.GetCurrentValue());
}
- scoped_ptr<ListValue> args(new ListValue());
+ scoped_ptr<base::ListValue> args(new base::ListValue());
args->Append(processes);
DispatchEvent(keys::kOnUpdated, args.Pass());
}
if (updated_memory) {
- IDMap<DictionaryValue>::iterator it(&processes_map);
+ IDMap<base::DictionaryValue>::iterator it(&processes_map);
for (; !it.IsAtEnd(); it.Advance()) {
if (!it.GetCurrentValue()->GetInteger(idkey, &id))
continue;
@@ -381,7 +381,7 @@ void ProcessesEventRouter::OnItemsChanged(int start, int length) {
processes->Set(base::IntToString(id), it.GetCurrentValue());
}
- scoped_ptr<ListValue> args(new ListValue());
+ scoped_ptr<base::ListValue> args(new base::ListValue());
args->Append(processes);
DispatchEvent(keys::kOnUpdatedWithMemory, args.Pass());
}
@@ -400,7 +400,7 @@ void ProcessesEventRouter::OnItemsToBeRemoved(int start, int length) {
return;
// The callback function parameters.
- scoped_ptr<ListValue> args(new ListValue());
+ scoped_ptr<base::ListValue> args(new base::ListValue());
// First arg: The id of the process that was closed.
args->Append(Value::CreateIntegerValue(
@@ -422,7 +422,7 @@ void ProcessesEventRouter::ProcessHangEvent(content::RenderWidgetHost* widget) {
if (!HasEventListeners(event))
return;
- DictionaryValue* process = NULL;
+ base::DictionaryValue* process = NULL;
int count = model_->ResourceCount();
int id = widget->GetProcess()->GetID();
@@ -439,7 +439,7 @@ void ProcessesEventRouter::ProcessHangEvent(content::RenderWidgetHost* widget) {
if (process == NULL)
return;
- scoped_ptr<ListValue> args(new ListValue());
+ scoped_ptr<base::ListValue> args(new base::ListValue());
args->Append(process);
DispatchEvent(keys::kOnUnresponsive, args.Pass());
@@ -451,7 +451,7 @@ void ProcessesEventRouter::ProcessClosedEvent(
content::RenderProcessHost::RendererClosedDetails* details) {
#if defined(ENABLE_TASK_MANAGER)
// The callback function parameters.
- scoped_ptr<ListValue> args(new ListValue());
+ scoped_ptr<base::ListValue> args(new base::ListValue());
// First arg: The id of the process that was closed.
args->Append(Value::CreateIntegerValue(rph->GetID()));
@@ -466,8 +466,9 @@ void ProcessesEventRouter::ProcessClosedEvent(
#endif // defined(ENABLE_TASK_MANAGER)
}
-void ProcessesEventRouter::DispatchEvent(const char* event_name,
- scoped_ptr<ListValue> event_args) {
+void ProcessesEventRouter::DispatchEvent(
+ const char* event_name,
+ scoped_ptr<base::ListValue> event_args) {
if (extensions::ExtensionSystem::Get(profile_)->event_router()) {
scoped_ptr<extensions::Event> event(new extensions::Event(
event_name, event_args.Pass()));
@@ -732,7 +733,7 @@ void GetProcessInfoFunction::Observe(
void GetProcessInfoFunction::GatherProcessInfo() {
#if defined(ENABLE_TASK_MANAGER)
TaskManagerModel* model = TaskManager::GetInstance()->model();
- DictionaryValue* processes = new DictionaryValue();
+ base::DictionaryValue* processes = new base::DictionaryValue();
// If there are no process IDs specified, it means we need to return all of
// the ones we know of.
@@ -741,7 +742,7 @@ void GetProcessInfoFunction::GatherProcessInfo() {
for (int i = 0; i < resources; ++i) {
if (model->IsResourceFirstInGroup(i)) {
int id = model->GetUniqueChildProcessId(i);
- DictionaryValue* d = CreateProcessFromModel(id, model, i, false);
+ base::DictionaryValue* d = CreateProcessFromModel(id, model, i, false);
if (memory_)
AddMemoryDetails(d, model, i);
processes->Set(base::IntToString(id), d);
@@ -755,7 +756,8 @@ void GetProcessInfoFunction::GatherProcessInfo() {
std::vector<int>::iterator proc_id = std::find(process_ids_.begin(),
process_ids_.end(), id);
if (proc_id != process_ids_.end()) {
- DictionaryValue* d = CreateProcessFromModel(id, model, i, false);
+ base::DictionaryValue* d =
+ CreateProcessFromModel(id, model, i, false);
if (memory_)
AddMemoryDetails(d, model, i);
processes->Set(base::IntToString(id), d);

Powered by Google App Engine
This is Rietveld 408576698