Chromium Code Reviews| Index: chrome/browser/ui/webui/inspect_ui.cc |
| diff --git a/chrome/browser/ui/webui/inspect_ui.cc b/chrome/browser/ui/webui/inspect_ui.cc |
| index a887f73f2714657e937f17ba44756b2ab02a1d3e..a38a18864ad1e0b442fd41b01c74a7636e12478e 100644 |
| --- a/chrome/browser/ui/webui/inspect_ui.cc |
| +++ b/chrome/browser/ui/webui/inspect_ui.cc |
| @@ -275,29 +275,41 @@ void InspectUI::InitUI() { |
| void InspectUI::Inspect(const std::string& source_id, |
| const std::string& target_id) { |
| DevToolsTargetImpl* target = FindTarget(source_id, target_id); |
| - if (target) |
| + if (target) { |
| + std::string target_type = target->GetType(); |
| target->Inspect(Profile::FromWebUI(web_ui())); |
| + ForceUpdateIfNeeded(source_id, target_type); |
|
horo
2014/09/16 07:41:37
ForceUpdateIfNeeded(source_id, target->GetType());
dgozman
2014/09/16 08:55:34
What if executing action will lead to target being
horo
2014/09/16 10:31:19
Ah, I got it.
|
| + } |
| } |
| void InspectUI::Activate(const std::string& source_id, |
| const std::string& target_id) { |
| DevToolsTargetImpl* target = FindTarget(source_id, target_id); |
| - if (target) |
| + if (target) { |
| + std::string target_type = target->GetType(); |
| target->Activate(); |
| + ForceUpdateIfNeeded(source_id, target_type); |
|
horo
2014/09/16 07:41:37
ditto
|
| + } |
| } |
| void InspectUI::Close(const std::string& source_id, |
| const std::string& target_id) { |
| DevToolsTargetImpl* target = FindTarget(source_id, target_id); |
| - if (target) |
| + if (target) { |
| + std::string target_type = target->GetType(); |
| target->Close(); |
| + ForceUpdateIfNeeded(source_id, target_type); |
|
horo
2014/09/16 07:41:38
ditto
|
| + } |
| } |
| void InspectUI::Reload(const std::string& source_id, |
| const std::string& target_id) { |
| DevToolsTargetImpl* target = FindTarget(source_id, target_id); |
| - if (target) |
| + if (target) { |
| + std::string target_type = target->GetType(); |
| target->Reload(); |
| + ForceUpdateIfNeeded(source_id, target_type); |
|
horo
2014/09/16 07:41:38
ditto
|
| + } |
| } |
| static void NoOp(DevToolsTargetImpl*) {} |
| @@ -528,6 +540,17 @@ void InspectUI::PopulateTargets(const std::string& source, |
| targets); |
| } |
| +void InspectUI::ForceUpdateIfNeeded(const std::string& source_id, |
| + const std::string& target_type) { |
| + // TODO(dgozman): remove this after moving discovery to protocol. |
| + // See crbug.com/398049. |
| + if (target_type != DevToolsTargetImpl::kTargetTypeServiceWorker) |
| + return; |
| + DevToolsTargetsUIHandler* handler = FindTargetHandler(source_id); |
| + if (handler) |
| + handler->ForceUpdate(); |
| +} |
| + |
| void InspectUI::PopulatePortStatus(const base::Value& status) { |
| web_ui()->CallJavascriptFunction("populatePortStatus", status); |
| } |