OLD | NEW |
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 Loading... |
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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 return web_contents_->GetRenderViewHost(); | 369 return web_contents_->GetRenderViewHost(); |
370 } | 370 } |
371 | 371 |
372 void DevToolsWindow::CreateDevToolsBrowser() { | 372 void DevToolsWindow::CreateDevToolsBrowser() { |
373 // TODO(pfeldman): Make browser's getter for this key static. | 373 // TODO(pfeldman): Make browser's getter for this key static. |
374 std::string wp_key; | 374 std::string wp_key; |
375 wp_key.append(prefs::kBrowserWindowPlacement); | 375 wp_key.append(prefs::kBrowserWindowPlacement); |
376 wp_key.append("_"); | 376 wp_key.append("_"); |
377 wp_key.append(kDevToolsApp); | 377 wp_key.append(kDevToolsApp); |
378 | 378 |
379 PrefService* prefs = profile_->GetPrefs(); | 379 PrefServiceSyncable* prefs = profile_->GetPrefs(); |
380 if (!prefs->FindPreference(wp_key.c_str())) { | 380 if (!prefs->FindPreference(wp_key.c_str())) { |
381 prefs->RegisterDictionaryPref(wp_key.c_str(), PrefService::UNSYNCABLE_PREF); | 381 prefs->RegisterDictionaryPref(wp_key.c_str(), |
| 382 PrefServiceSyncable::UNSYNCABLE_PREF); |
382 } | 383 } |
383 | 384 |
384 const DictionaryValue* wp_pref = prefs->GetDictionary(wp_key.c_str()); | 385 const DictionaryValue* wp_pref = prefs->GetDictionary(wp_key.c_str()); |
385 if (!wp_pref || wp_pref->empty()) { | 386 if (!wp_pref || wp_pref->empty()) { |
386 DictionaryPrefUpdate update(prefs, wp_key.c_str()); | 387 DictionaryPrefUpdate update(prefs, wp_key.c_str()); |
387 DictionaryValue* defaults = update.Get(); | 388 DictionaryValue* defaults = update.Get(); |
388 defaults->SetInteger("left", 100); | 389 defaults->SetInteger("left", 100); |
389 defaults->SetInteger("top", 100); | 390 defaults->SetInteger("top", 100); |
390 defaults->SetInteger("right", 740); | 391 defaults->SetInteger("right", 740); |
391 defaults->SetInteger("bottom", 740); | 392 defaults->SetInteger("bottom", 740); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 | 906 |
906 // static | 907 // static |
907 DevToolsDockSide DevToolsWindow::SideFromString( | 908 DevToolsDockSide DevToolsWindow::SideFromString( |
908 const std::string& dock_side) { | 909 const std::string& dock_side) { |
909 if (dock_side == kDockSideRight) | 910 if (dock_side == kDockSideRight) |
910 return DEVTOOLS_DOCK_SIDE_RIGHT; | 911 return DEVTOOLS_DOCK_SIDE_RIGHT; |
911 if (dock_side == kDockSideBottom) | 912 if (dock_side == kDockSideBottom) |
912 return DEVTOOLS_DOCK_SIDE_BOTTOM; | 913 return DEVTOOLS_DOCK_SIDE_BOTTOM; |
913 return DEVTOOLS_DOCK_SIDE_UNDOCKED; | 914 return DEVTOOLS_DOCK_SIDE_UNDOCKED; |
914 } | 915 } |
OLD | NEW |