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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 6353015: Fix broken PrefService::preference_set() returning not all registered preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 9 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/prefs/pref_service.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 AutomationJSONReply(this, reply_message).SendError( 2784 AutomationJSONReply(this, reply_message).SendError(
2785 StringPrintf("Invalid action: %s", action.c_str())); 2785 StringPrintf("Invalid action: %s", action.c_str()));
2786 } 2786 }
2787 } 2787 }
2788 2788
2789 // Sample json input: { "command": "GetPrefsInfo" } 2789 // Sample json input: { "command": "GetPrefsInfo" }
2790 // Refer chrome/test/pyautolib/prefs_info.py for sample json output. 2790 // Refer chrome/test/pyautolib/prefs_info.py for sample json output.
2791 void TestingAutomationProvider::GetPrefsInfo(Browser* browser, 2791 void TestingAutomationProvider::GetPrefsInfo(Browser* browser,
2792 DictionaryValue* args, 2792 DictionaryValue* args,
2793 IPC::Message* reply_message) { 2793 IPC::Message* reply_message) {
2794 const PrefService::PreferenceSet& prefs = 2794 DictionaryValue* items = profile_->GetPrefs()->GetPreferenceValues();
2795 profile_->GetPrefs()->preference_set(); 2795
2796 DictionaryValue* items = new DictionaryValue;
2797 for (PrefService::PreferenceSet::const_iterator it = prefs.begin();
2798 it != prefs.end(); ++it) {
2799 items->Set((*it)->name(), (*it)->GetValue()->DeepCopy());
2800 }
2801 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 2796 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
2802 return_value->Set("prefs", items); // return_value owns items. 2797 return_value->Set("prefs", items); // return_value owns items.
2803 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); 2798 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
2804 } 2799 }
2805 2800
2806 // Sample json input: { "command": "SetPrefs", "path": path, "value": value } 2801 // Sample json input: { "command": "SetPrefs", "path": path, "value": value }
2807 void TestingAutomationProvider::SetPrefs(Browser* browser, 2802 void TestingAutomationProvider::SetPrefs(Browser* browser,
2808 DictionaryValue* args, 2803 DictionaryValue* args,
2809 IPC::Message* reply_message) { 2804 IPC::Message* reply_message) {
2810 std::string path; 2805 std::string path;
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
4514 // If you change this, update Observer for NotificationType::SESSION_END 4509 // If you change this, update Observer for NotificationType::SESSION_END
4515 // below. 4510 // below.
4516 MessageLoop::current()->PostTask(FROM_HERE, 4511 MessageLoop::current()->PostTask(FROM_HERE,
4517 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); 4512 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider));
4518 } 4513 }
4519 } 4514 }
4520 4515
4521 void TestingAutomationProvider::OnRemoveProvider() { 4516 void TestingAutomationProvider::OnRemoveProvider() {
4522 AutomationProviderList::GetInstance()->RemoveProvider(this); 4517 AutomationProviderList::GetInstance()->RemoveProvider(this);
4523 } 4518 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prefs/pref_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698