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 // Implements the Chrome Extensions Debugger API. | 5 // Implements the Chrome Extensions Debugger API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" | 7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/common/extensions/api/debugger.h" | 29 #include "chrome/common/extensions/api/debugger.h" |
30 #include "chrome/common/extensions/extension.h" | 30 #include "chrome/common/extensions/extension.h" |
31 #include "content/public/browser/devtools_agent_host.h" | 31 #include "content/public/browser/devtools_agent_host.h" |
32 #include "content/public/browser/devtools_client_host.h" | 32 #include "content/public/browser/devtools_client_host.h" |
33 #include "content/public/browser/devtools_manager.h" | 33 #include "content/public/browser/devtools_manager.h" |
34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
35 #include "content/public/browser/notification_source.h" | 35 #include "content/public/browser/notification_source.h" |
36 #include "content/public/browser/render_view_host.h" | 36 #include "content/public/browser/render_view_host.h" |
37 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
38 #include "content/public/common/content_client.h" | 38 #include "content/public/common/content_client.h" |
| 39 #include "content/public/common/url_constants.h" |
39 #include "extensions/common/error_utils.h" | 40 #include "extensions/common/error_utils.h" |
40 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
41 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
42 #include "webkit/glue/webkit_glue.h" | 43 #include "webkit/glue/webkit_glue.h" |
43 | 44 |
44 using content::DevToolsAgentHost; | 45 using content::DevToolsAgentHost; |
45 using content::DevToolsClientHost; | 46 using content::DevToolsClientHost; |
46 using content::DevToolsManager; | 47 using content::DevToolsManager; |
47 using content::WebContents; | 48 using content::WebContents; |
48 using extensions::api::debugger::Debuggee; | 49 using extensions::api::debugger::Debuggee; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 bool result = ExtensionTabUtil::GetTabById( | 422 bool result = ExtensionTabUtil::GetTabById( |
422 tab_id_, profile(), include_incognito(), NULL, NULL, &web_contents, NULL); | 423 tab_id_, profile(), include_incognito(), NULL, NULL, &web_contents, NULL); |
423 if (!result || !web_contents) { | 424 if (!result || !web_contents) { |
424 error_ = ErrorUtils::FormatErrorMessage( | 425 error_ = ErrorUtils::FormatErrorMessage( |
425 keys::kNoTabError, | 426 keys::kNoTabError, |
426 base::IntToString(tab_id_)); | 427 base::IntToString(tab_id_)); |
427 return false; | 428 return false; |
428 } | 429 } |
429 contents_ = web_contents; | 430 contents_ = web_contents; |
430 | 431 |
431 if (content::GetContentClient()->HasWebUIScheme( | 432 if (content::HasWebUIScheme(contents_->GetURL())) { |
432 contents_->GetURL())) { | |
433 error_ = ErrorUtils::FormatErrorMessage( | 433 error_ = ErrorUtils::FormatErrorMessage( |
434 keys::kAttachToWebUIError, | 434 keys::kAttachToWebUIError, |
435 contents_->GetURL().scheme()); | 435 contents_->GetURL().scheme()); |
436 return false; | 436 return false; |
437 } | 437 } |
438 | 438 |
439 return true; | 439 return true; |
440 } | 440 } |
441 | 441 |
442 bool DebuggerFunction::InitClientHost() { | 442 bool DebuggerFunction::InitClientHost() { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 } | 541 } |
542 | 542 |
543 DictionaryValue* result_body; | 543 DictionaryValue* result_body; |
544 SendCommand::Results::Result result; | 544 SendCommand::Results::Result result; |
545 if (response->GetDictionary("result", &result_body)) | 545 if (response->GetDictionary("result", &result_body)) |
546 result.additional_properties.Swap(result_body); | 546 result.additional_properties.Swap(result_body); |
547 | 547 |
548 results_ = SendCommand::Results::Create(result); | 548 results_ = SendCommand::Results::Create(result); |
549 SendResponse(true); | 549 SendResponse(true); |
550 } | 550 } |
OLD | NEW |