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 "chrome/browser/devtools/devtools_window.h" |
| 6 |
5 #include <algorithm> | 7 #include <algorithm> |
6 | 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
9 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
10 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
11 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
12 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 15 #include "base/values.h" |
14 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/devtools/devtools_window.h" | |
16 #include "chrome/browser/extensions/api/debugger/debugger_api.h" | 17 #include "chrome/browser/extensions/api/debugger/debugger_api.h" |
17 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/extensions/extension_system.h" | 19 #include "chrome/browser/extensions/extension_system.h" |
19 #include "chrome/browser/file_select_helper.h" | 20 #include "chrome/browser/file_select_helper.h" |
20 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 21 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
21 #include "chrome/browser/prefs/pref_service_syncable.h" | 22 #include "chrome/browser/prefs/pref_service_syncable.h" |
22 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 23 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/sessions/session_tab_helper.h" | 25 #include "chrome/browser/sessions/session_tab_helper.h" |
25 #include "chrome/browser/themes/theme_properties.h" | 26 #include "chrome/browser/themes/theme_properties.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // static | 173 // static |
173 std::string DevToolsWindow::GetDevToolsWindowPlacementPrefKey() { | 174 std::string DevToolsWindow::GetDevToolsWindowPlacementPrefKey() { |
174 std::string wp_key; | 175 std::string wp_key; |
175 wp_key.append(prefs::kBrowserWindowPlacement); | 176 wp_key.append(prefs::kBrowserWindowPlacement); |
176 wp_key.append("_"); | 177 wp_key.append("_"); |
177 wp_key.append(kDevToolsApp); | 178 wp_key.append(kDevToolsApp); |
178 return wp_key; | 179 return wp_key; |
179 } | 180 } |
180 | 181 |
181 // static | 182 // static |
182 void DevToolsWindow::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 183 void DevToolsWindow::RegisterUserPrefs( |
183 registry->RegisterBooleanPref(prefs::kDevToolsOpenDocked, | 184 user_prefs::PrefRegistrySyncable* registry) { |
184 true, | 185 registry->RegisterBooleanPref( |
185 PrefRegistrySyncable::UNSYNCABLE_PREF); | 186 prefs::kDevToolsOpenDocked, |
186 registry->RegisterStringPref(prefs::kDevToolsDockSide, | 187 true, |
187 kDockSideBottom, | 188 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
188 PrefRegistrySyncable::UNSYNCABLE_PREF); | 189 registry->RegisterStringPref( |
189 registry->RegisterDictionaryPref(prefs::kDevToolsEditedFiles, | 190 prefs::kDevToolsDockSide, |
190 PrefRegistrySyncable::UNSYNCABLE_PREF); | 191 kDockSideBottom, |
191 registry->RegisterDictionaryPref(prefs::kDevToolsFileSystemPaths, | 192 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
192 PrefRegistrySyncable::UNSYNCABLE_PREF); | 193 registry->RegisterDictionaryPref( |
| 194 prefs::kDevToolsEditedFiles, |
| 195 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 196 registry->RegisterDictionaryPref( |
| 197 prefs::kDevToolsFileSystemPaths, |
| 198 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
193 | 199 |
194 registry->RegisterDictionaryPref(GetDevToolsWindowPlacementPrefKey().c_str(), | 200 registry->RegisterDictionaryPref( |
195 PrefRegistrySyncable::UNSYNCABLE_PREF); | 201 GetDevToolsWindowPlacementPrefKey().c_str(), |
| 202 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
196 } | 203 } |
197 | 204 |
198 // static | 205 // static |
199 DevToolsWindow* DevToolsWindow::GetDockedInstanceForInspectedTab( | 206 DevToolsWindow* DevToolsWindow::GetDockedInstanceForInspectedTab( |
200 WebContents* inspected_web_contents) { | 207 WebContents* inspected_web_contents) { |
201 if (!inspected_web_contents) | 208 if (!inspected_web_contents) |
202 return NULL; | 209 return NULL; |
203 | 210 |
204 if (!DevToolsAgentHost::HasFor(inspected_web_contents->GetRenderViewHost())) | 211 if (!DevToolsAgentHost::HasFor(inspected_web_contents->GetRenderViewHost())) |
205 return NULL; | 212 return NULL; |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 DevToolsDockSide DevToolsWindow::SideFromString( | 1173 DevToolsDockSide DevToolsWindow::SideFromString( |
1167 const std::string& dock_side) { | 1174 const std::string& dock_side) { |
1168 if (dock_side == kDockSideRight) | 1175 if (dock_side == kDockSideRight) |
1169 return DEVTOOLS_DOCK_SIDE_RIGHT; | 1176 return DEVTOOLS_DOCK_SIDE_RIGHT; |
1170 if (dock_side == kDockSideBottom) | 1177 if (dock_side == kDockSideBottom) |
1171 return DEVTOOLS_DOCK_SIDE_BOTTOM; | 1178 return DEVTOOLS_DOCK_SIDE_BOTTOM; |
1172 if (dock_side == kDockSideMinimized) | 1179 if (dock_side == kDockSideMinimized) |
1173 return DEVTOOLS_DOCK_SIDE_MINIMIZED; | 1180 return DEVTOOLS_DOCK_SIDE_MINIMIZED; |
1174 return DEVTOOLS_DOCK_SIDE_UNDOCKED; | 1181 return DEVTOOLS_DOCK_SIDE_UNDOCKED; |
1175 } | 1182 } |
OLD | NEW |