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

Side by Side Diff: chrome/browser/ui/webui/inspect_ui.cc

Issue 2273063002: DevTools: remove DevToolsTargetDescriptor and its implementations, we are now based on devtools age… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 4 years, 3 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 #include "chrome/browser/ui/webui/inspect_ui.h" 5 #include "chrome/browser/ui/webui/inspect_ui.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chrome/browser/devtools/devtools_target_impl.h"
10 #include "chrome/browser/devtools/devtools_targets_ui.h" 9 #include "chrome/browser/devtools/devtools_targets_ui.h"
11 #include "chrome/browser/devtools/devtools_ui_bindings.h" 10 #include "chrome/browser/devtools/devtools_ui_bindings.h"
12 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser_navigator_params.h" 12 #include "chrome/browser/ui/browser_navigator_params.h"
14 #include "chrome/browser/ui/singleton_tabs.h" 13 #include "chrome/browser/ui/singleton_tabs.h"
15 #include "chrome/browser/ui/webui/theme_source.h" 14 #include "chrome/browser/ui/webui/theme_source.h"
16 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
17 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
18 #include "components/prefs/pref_service.h" 17 #include "components/prefs/pref_service.h"
19 #include "content/public/browser/devtools_agent_host.h" 18 #include "content/public/browser/devtools_agent_host.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 497
499 DevToolsTargetsUIHandler* InspectUI::FindTargetHandler( 498 DevToolsTargetsUIHandler* InspectUI::FindTargetHandler(
500 const std::string& source_id) { 499 const std::string& source_id) {
501 TargetHandlerMap::iterator it = target_handlers_.find(source_id); 500 TargetHandlerMap::iterator it = target_handlers_.find(source_id);
502 return it != target_handlers_.end() ? it->second : nullptr; 501 return it != target_handlers_.end() ? it->second : nullptr;
503 } 502 }
504 503
505 scoped_refptr<content::DevToolsAgentHost> InspectUI::FindTarget( 504 scoped_refptr<content::DevToolsAgentHost> InspectUI::FindTarget(
506 const std::string& source_id, const std::string& target_id) { 505 const std::string& source_id, const std::string& target_id) {
507 TargetHandlerMap::iterator it = target_handlers_.find(source_id); 506 TargetHandlerMap::iterator it = target_handlers_.find(source_id);
508 DevToolsTargetImpl* target = it != target_handlers_.end() ? 507 return it != target_handlers_.end() ?
509 it->second->GetTarget(target_id) : nullptr; 508 it->second->GetTarget(target_id) : nullptr;
510 return target ? target->GetAgentHost() : nullptr;
511 } 509 }
512 510
513 void InspectUI::PopulateTargets(const std::string& source, 511 void InspectUI::PopulateTargets(const std::string& source,
514 const base::ListValue& targets) { 512 const base::ListValue& targets) {
515 web_ui()->CallJavascriptFunctionUnsafe("populateTargets", 513 web_ui()->CallJavascriptFunctionUnsafe("populateTargets",
516 base::StringValue(source), targets); 514 base::StringValue(source), targets);
517 } 515 }
518 516
519 void InspectUI::ForceUpdateIfNeeded(const std::string& source_id, 517 void InspectUI::ForceUpdateIfNeeded(const std::string& source_id,
520 const std::string& target_type) { 518 const std::string& target_type) {
521 // TODO(dgozman): remove this after moving discovery to protocol. 519 // TODO(dgozman): remove this after moving discovery to protocol.
522 // See crbug.com/398049. 520 // See crbug.com/398049.
523 if (target_type != content::DevToolsAgentHost::kTypeServiceWorker) 521 if (target_type != content::DevToolsAgentHost::kTypeServiceWorker)
524 return; 522 return;
525 DevToolsTargetsUIHandler* handler = FindTargetHandler(source_id); 523 DevToolsTargetsUIHandler* handler = FindTargetHandler(source_id);
526 if (handler) 524 if (handler)
527 handler->ForceUpdate(); 525 handler->ForceUpdate();
528 } 526 }
529 527
530 void InspectUI::PopulatePortStatus(const base::Value& status) { 528 void InspectUI::PopulatePortStatus(const base::Value& status) {
531 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); 529 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status);
532 } 530 }
533 531
534 void InspectUI::ShowIncognitoWarning() { 532 void InspectUI::ShowIncognitoWarning() {
535 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); 533 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning");
536 } 534 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698