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(); |
horo
2014/09/16 10:31:20
const
dgozman
2014/09/16 12:42:38
All done.
|
target->Inspect(Profile::FromWebUI(web_ui())); |
+ ForceUpdateIfNeeded(source_id, target_type); |
+ } |
} |
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(); |
horo
2014/09/16 10:31:20
ditto
|
target->Activate(); |
+ ForceUpdateIfNeeded(source_id, target_type); |
+ } |
} |
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(); |
horo
2014/09/16 10:31:19
ditto
|
target->Close(); |
+ ForceUpdateIfNeeded(source_id, target_type); |
+ } |
} |
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); |
+ } |
} |
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); |
} |