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

Side by Side Diff: chrome/browser/devtools/devtools_window.cc

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 const char kDockSideRight[] = "right"; 80 const char kDockSideRight[] = "right";
81 const char kDockSideUndocked[] = "undocked"; 81 const char kDockSideUndocked[] = "undocked";
82 82
83 // Minimal height of devtools pane or content pane when devtools are docked 83 // Minimal height of devtools pane or content pane when devtools are docked
84 // to the browser window. 84 // to the browser window.
85 const int kMinDevToolsHeight = 50; 85 const int kMinDevToolsHeight = 50;
86 const int kMinDevToolsWidth = 150; 86 const int kMinDevToolsWidth = 150;
87 const int kMinContentsSize = 50; 87 const int kMinContentsSize = 50;
88 88
89 // static 89 // static
90 void DevToolsWindow::RegisterUserPrefs(PrefService* prefs) { 90 void DevToolsWindow::RegisterUserPrefs(PrefServiceSyncable* prefs) {
91 prefs->RegisterBooleanPref(prefs::kDevToolsOpenDocked, 91 prefs->RegisterBooleanPref(prefs::kDevToolsOpenDocked,
92 true, 92 true,
93 PrefService::UNSYNCABLE_PREF); 93 PrefServiceSyncable::UNSYNCABLE_PREF);
94 prefs->RegisterStringPref(prefs::kDevToolsDockSide, 94 prefs->RegisterStringPref(prefs::kDevToolsDockSide,
95 kDockSideBottom, 95 kDockSideBottom,
96 PrefService::UNSYNCABLE_PREF); 96 PrefServiceSyncable::UNSYNCABLE_PREF);
97 prefs->RegisterDictionaryPref(prefs::kDevToolsEditedFiles, 97 prefs->RegisterDictionaryPref(prefs::kDevToolsEditedFiles,
98 PrefService::UNSYNCABLE_PREF); 98 PrefServiceSyncable::UNSYNCABLE_PREF);
99 } 99 }
100 100
101 // static 101 // static
102 DevToolsWindow* DevToolsWindow::GetDockedInstanceForInspectedTab( 102 DevToolsWindow* DevToolsWindow::GetDockedInstanceForInspectedTab(
103 WebContents* inspected_web_contents) { 103 WebContents* inspected_web_contents) {
104 if (!inspected_web_contents) 104 if (!inspected_web_contents)
105 return NULL; 105 return NULL;
106 106
107 if (!DevToolsAgentHostRegistry::HasDevToolsAgentHost( 107 if (!DevToolsAgentHostRegistry::HasDevToolsAgentHost(
108 inspected_web_contents->GetRenderViewHost())) 108 inspected_web_contents->GetRenderViewHost()))
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 return web_contents_->GetRenderViewHost(); 365 return web_contents_->GetRenderViewHost();
366 } 366 }
367 367
368 void DevToolsWindow::CreateDevToolsBrowser() { 368 void DevToolsWindow::CreateDevToolsBrowser() {
369 // TODO(pfeldman): Make browser's getter for this key static. 369 // TODO(pfeldman): Make browser's getter for this key static.
370 std::string wp_key; 370 std::string wp_key;
371 wp_key.append(prefs::kBrowserWindowPlacement); 371 wp_key.append(prefs::kBrowserWindowPlacement);
372 wp_key.append("_"); 372 wp_key.append("_");
373 wp_key.append(kDevToolsApp); 373 wp_key.append(kDevToolsApp);
374 374
375 PrefService* prefs = profile_->GetPrefs(); 375 PrefServiceSyncable* prefs = profile_->GetPrefs();
376 if (!prefs->FindPreference(wp_key.c_str())) { 376 if (!prefs->FindPreference(wp_key.c_str())) {
377 prefs->RegisterDictionaryPref(wp_key.c_str(), PrefService::UNSYNCABLE_PREF); 377 prefs->RegisterDictionaryPref(wp_key.c_str(),
378 PrefServiceSyncable::UNSYNCABLE_PREF);
378 } 379 }
379 380
380 const DictionaryValue* wp_pref = prefs->GetDictionary(wp_key.c_str()); 381 const DictionaryValue* wp_pref = prefs->GetDictionary(wp_key.c_str());
381 if (!wp_pref || wp_pref->empty()) { 382 if (!wp_pref || wp_pref->empty()) {
382 DictionaryPrefUpdate update(prefs, wp_key.c_str()); 383 DictionaryPrefUpdate update(prefs, wp_key.c_str());
383 DictionaryValue* defaults = update.Get(); 384 DictionaryValue* defaults = update.Get();
384 defaults->SetInteger("left", 100); 385 defaults->SetInteger("left", 100);
385 defaults->SetInteger("top", 100); 386 defaults->SetInteger("top", 100);
386 defaults->SetInteger("right", 740); 387 defaults->SetInteger("right", 740);
387 defaults->SetInteger("bottom", 740); 388 defaults->SetInteger("bottom", 740);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 902
902 // static 903 // static
903 DevToolsDockSide DevToolsWindow::SideFromString( 904 DevToolsDockSide DevToolsWindow::SideFromString(
904 const std::string& dock_side) { 905 const std::string& dock_side) {
905 if (dock_side == kDockSideRight) 906 if (dock_side == kDockSideRight)
906 return DEVTOOLS_DOCK_SIDE_RIGHT; 907 return DEVTOOLS_DOCK_SIDE_RIGHT;
907 if (dock_side == kDockSideBottom) 908 if (dock_side == kDockSideBottom)
908 return DEVTOOLS_DOCK_SIDE_BOTTOM; 909 return DEVTOOLS_DOCK_SIDE_BOTTOM;
909 return DEVTOOLS_DOCK_SIDE_UNDOCKED; 910 return DEVTOOLS_DOCK_SIDE_UNDOCKED;
910 } 911 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | chrome/browser/download/chrome_download_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698