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 // Implements the Chrome Extensions Debugger API. | 5 // Implements the Chrome Extensions Debugger API. |
6 | 6 |
7 #include "chrome/browser/extensions/extension_debugger_api.h" | 7 #include "chrome/browser/extensions/extension_debugger_api.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/extensions/extension_debugger_api_constants.h" | 18 #include "chrome/browser/extensions/extension_debugger_api_constants.h" |
19 #include "chrome/browser/extensions/extension_event_router.h" | 19 #include "chrome/browser/extensions/extension_event_router.h" |
20 #include "chrome/browser/extensions/extension_tab_util.h" | 20 #include "chrome/browser/extensions/extension_tab_util.h" |
21 #include "chrome/browser/infobars/infobar_tab_helper.h" | 21 #include "chrome/browser/infobars/infobar_tab_helper.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 23 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
25 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" | 25 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
26 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
27 #include "chrome/common/extensions/extension.h" | 27 #include "chrome/common/extensions/extension.h" |
28 #include "chrome/common/extensions/extension_error_utils.h" | 28 #include "chrome/common/extensions/extension_error_utils.h" |
29 #include "content/browser/renderer_host/render_view_host.h" | 29 #include "content/browser/renderer_host/render_view_host.h" |
30 #include "content/public/browser/devtools_agent_host_registry.h" | 30 #include "content/public/browser/devtools_agent_host_registry.h" |
31 #include "content/public/browser/devtools_client_host.h" | 31 #include "content/public/browser/devtools_client_host.h" |
32 #include "content/public/browser/devtools_manager.h" | 32 #include "content/public/browser/devtools_manager.h" |
33 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
34 #include "content/public/browser/notification_source.h" | 34 #include "content/public/browser/notification_source.h" |
35 #include "content/public/browser/render_view_host_delegate.h" | 35 #include "content/public/browser/render_view_host_delegate.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 bool result = ExtensionTabUtil::GetTabById( | 370 bool result = ExtensionTabUtil::GetTabById( |
371 tab_id_, profile(), include_incognito(), NULL, NULL, &wrapper, NULL); | 371 tab_id_, profile(), include_incognito(), NULL, NULL, &wrapper, NULL); |
372 if (!result || !wrapper) { | 372 if (!result || !wrapper) { |
373 error_ = ExtensionErrorUtils::FormatErrorMessage( | 373 error_ = ExtensionErrorUtils::FormatErrorMessage( |
374 keys::kNoTabError, | 374 keys::kNoTabError, |
375 base::IntToString(tab_id_)); | 375 base::IntToString(tab_id_)); |
376 return false; | 376 return false; |
377 } | 377 } |
378 contents_ = wrapper->web_contents(); | 378 contents_ = wrapper->web_contents(); |
379 | 379 |
380 if (ChromeWebUIFactory::GetInstance()->HasWebUIScheme(contents_->GetURL())) { | 380 if (ChromeWebUIControllerFactory::GetInstance()->HasWebUIScheme( |
| 381 contents_->GetURL())) { |
381 error_ = ExtensionErrorUtils::FormatErrorMessage( | 382 error_ = ExtensionErrorUtils::FormatErrorMessage( |
382 keys::kAttachToWebUIError, | 383 keys::kAttachToWebUIError, |
383 contents_->GetURL().scheme()); | 384 contents_->GetURL().scheme()); |
384 return false; | 385 return false; |
385 } | 386 } |
386 | 387 |
387 return true; | 388 return true; |
388 } | 389 } |
389 | 390 |
390 bool DebuggerFunction::InitClientHost() { | 391 bool DebuggerFunction::InitClientHost() { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 return; | 486 return; |
486 } | 487 } |
487 | 488 |
488 Value* result_body; | 489 Value* result_body; |
489 if (dictionary->Get("result", &result_body)) | 490 if (dictionary->Get("result", &result_body)) |
490 result_.reset(result_body->DeepCopy()); | 491 result_.reset(result_body->DeepCopy()); |
491 else | 492 else |
492 result_.reset(new DictionaryValue()); | 493 result_.reset(new DictionaryValue()); |
493 SendResponse(true); | 494 SendResponse(true); |
494 } | 495 } |
OLD | NEW |