| OLD | NEW |
| 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 <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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 namespace { | 51 namespace { |
| 52 base::LazyInstance<DevToolsWindowList, | 52 base::LazyInstance<DevToolsWindowList, |
| 53 base::LeakyLazyInstanceTraits<DevToolsWindowList> > | 53 base::LeakyLazyInstanceTraits<DevToolsWindowList> > |
| 54 g_instances = LAZY_INSTANCE_INITIALIZER; | 54 g_instances = LAZY_INSTANCE_INITIALIZER; |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 using content::DevToolsAgentHost; | 57 using content::DevToolsAgentHost; |
| 58 using content::DevToolsAgentHostRegistry; | 58 using content::DevToolsAgentHostRegistry; |
| 59 using content::DevToolsClientHost; | 59 using content::DevToolsClientHost; |
| 60 using content::DevToolsManager; | 60 using content::DevToolsManager; |
| 61 using content::NavigationEntry; |
| 61 using content::OpenURLParams; | 62 using content::OpenURLParams; |
| 62 using content::WebContents; | 63 using content::WebContents; |
| 63 | 64 |
| 64 const char DevToolsWindow::kDevToolsApp[] = "DevToolsApp"; | 65 const char DevToolsWindow::kDevToolsApp[] = "DevToolsApp"; |
| 65 | 66 |
| 66 // static | 67 // static |
| 67 void DevToolsWindow::RegisterUserPrefs(PrefService* prefs) { | 68 void DevToolsWindow::RegisterUserPrefs(PrefService* prefs) { |
| 68 prefs->RegisterBooleanPref(prefs::kDevToolsOpenDocked, | 69 prefs->RegisterBooleanPref(prefs::kDevToolsOpenDocked, |
| 69 true, | 70 true, |
| 70 PrefService::UNSYNCABLE_PREF); | 71 PrefService::UNSYNCABLE_PREF); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 browser_(NULL), | 184 browser_(NULL), |
| 184 docked_(docked), | 185 docked_(docked), |
| 185 is_loaded_(false), | 186 is_loaded_(false), |
| 186 action_on_load_(DEVTOOLS_TOGGLE_ACTION_NONE), | 187 action_on_load_(DEVTOOLS_TOGGLE_ACTION_NONE), |
| 187 frontend_host_(NULL) { | 188 frontend_host_(NULL) { |
| 188 frontend_host_ = DevToolsClientHost::CreateDevToolsFrontendHost( | 189 frontend_host_ = DevToolsClientHost::CreateDevToolsFrontendHost( |
| 189 tab_contents->tab_contents(), | 190 tab_contents->tab_contents(), |
| 190 this); | 191 this); |
| 191 g_instances.Get().push_back(this); | 192 g_instances.Get().push_back(this); |
| 192 // Wipe out page icon so that the default application icon is used. | 193 // Wipe out page icon so that the default application icon is used. |
| 193 content::NavigationEntry* entry = | 194 NavigationEntry* entry = |
| 194 tab_contents_->tab_contents()->GetController().GetActiveEntry(); | 195 tab_contents_->tab_contents()->GetController().GetActiveEntry(); |
| 195 entry->GetFavicon().bitmap = SkBitmap(); | 196 entry->GetFavicon().bitmap = SkBitmap(); |
| 196 entry->GetFavicon().valid = true; | 197 entry->GetFavicon().valid = true; |
| 197 | 198 |
| 198 // Register on-load actions. | 199 // Register on-load actions. |
| 199 registrar_.Add( | 200 registrar_.Add( |
| 200 this, | 201 this, |
| 201 content::NOTIFICATION_LOAD_STOP, | 202 content::NOTIFICATION_LOAD_STOP, |
| 202 content::Source<NavigationController>( | 203 content::Source<NavigationController>( |
| 203 &tab_contents_->tab_contents()->GetController())); | 204 &tab_contents_->tab_contents()->GetController())); |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 content); | 694 content); |
| 694 } | 695 } |
| 695 | 696 |
| 696 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 697 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
| 697 if (inspected_tab_ && inspected_tab_->tab_contents()->GetDelegate()) { | 698 if (inspected_tab_ && inspected_tab_->tab_contents()->GetDelegate()) { |
| 698 return inspected_tab_->tab_contents()->GetDelegate()-> | 699 return inspected_tab_->tab_contents()->GetDelegate()-> |
| 699 GetJavaScriptDialogCreator(); | 700 GetJavaScriptDialogCreator(); |
| 700 } | 701 } |
| 701 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); | 702 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); |
| 702 } | 703 } |
| OLD | NEW |