Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: chrome/browser/extensions/api/debugger/debugger_api.cc

Issue 1150683007: [Extensions] Use document url (not top url) for tab-specific permissions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 bool result = ExtensionTabUtil::GetTabById(*debuggee_.tab_id, 501 bool result = ExtensionTabUtil::GetTabById(*debuggee_.tab_id,
502 GetProfile(), 502 GetProfile(),
503 include_incognito(), 503 include_incognito(),
504 NULL, 504 NULL,
505 NULL, 505 NULL,
506 &web_contents, 506 &web_contents,
507 NULL); 507 NULL);
508 if (result && web_contents) { 508 if (result && web_contents) {
509 // TODO(rdevlin.cronin) This should definitely be GetLastCommittedURL(). 509 // TODO(rdevlin.cronin) This should definitely be GetLastCommittedURL().
510 GURL url = web_contents->GetVisibleURL(); 510 GURL url = web_contents->GetVisibleURL();
511 if (PermissionsData::IsRestrictedUrl(url, url, extension(), &error_)) 511 if (PermissionsData::IsRestrictedUrl(url, extension(), &error_))
512 return false; 512 return false;
513 agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents); 513 agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents);
514 } 514 }
515 } else if (debuggee_.extension_id) { 515 } else if (debuggee_.extension_id) {
516 ExtensionHost* extension_host = 516 ExtensionHost* extension_host =
517 ProcessManager::Get(GetProfile()) 517 ProcessManager::Get(GetProfile())
518 ->GetBackgroundHostForExtension(*debuggee_.extension_id); 518 ->GetBackgroundHostForExtension(*debuggee_.extension_id);
519 if (extension_host) { 519 if (extension_host) {
520 if (PermissionsData::IsRestrictedUrl(extension_host->GetURL(), 520 if (PermissionsData::IsRestrictedUrl(extension_host->GetURL(),
521 extension_host->GetURL(),
522 extension(), 521 extension(),
523 &error_)) { 522 &error_)) {
524 return false; 523 return false;
525 } 524 }
526 agent_host_ = 525 agent_host_ =
527 DevToolsAgentHost::GetOrCreateFor(extension_host->host_contents()); 526 DevToolsAgentHost::GetOrCreateFor(extension_host->host_contents());
528 } 527 }
529 } else if (debuggee_.target_id) { 528 } else if (debuggee_.target_id) {
530 agent_host_ = DevToolsAgentHost::GetForId(*debuggee_.target_id); 529 agent_host_ = DevToolsAgentHost::GetForId(*debuggee_.target_id);
531 if (agent_host_.get()) { 530 if (agent_host_.get()) {
532 if (PermissionsData::IsRestrictedUrl(agent_host_->GetURL(), 531 if (PermissionsData::IsRestrictedUrl(agent_host_->GetURL(),
533 agent_host_->GetURL(),
534 extension(), 532 extension(),
535 &error_)) { 533 &error_)) {
536 agent_host_ = nullptr; 534 agent_host_ = nullptr;
537 return false; 535 return false;
538 } 536 }
539 } 537 }
540 } else { 538 } else {
541 error_ = keys::kInvalidTargetError; 539 error_ = keys::kInvalidTargetError;
542 return false; 540 return false;
543 } 541 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 const std::vector<DevToolsTargetImpl*>& target_list) { 743 const std::vector<DevToolsTargetImpl*>& target_list) {
746 scoped_ptr<base::ListValue> result(new base::ListValue()); 744 scoped_ptr<base::ListValue> result(new base::ListValue());
747 for (size_t i = 0; i < target_list.size(); ++i) 745 for (size_t i = 0; i < target_list.size(); ++i)
748 result->Append(SerializeTarget(*target_list[i])); 746 result->Append(SerializeTarget(*target_list[i]));
749 STLDeleteContainerPointers(target_list.begin(), target_list.end()); 747 STLDeleteContainerPointers(target_list.begin(), target_list.end());
750 SetResult(result.release()); 748 SetResult(result.release());
751 SendResponse(true); 749 SendResponse(true);
752 } 750 }
753 751
754 } // namespace extensions 752 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698