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

Side by Side Diff: chrome/browser/devtools/device/devtools_android_bridge.cc

Issue 496363003: DevTools: Make Frontend treat remote service workers as workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/devtools/devtools_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/devtools/device/devtools_android_bridge.h" 5 #include "chrome/browser/devtools/device/devtools_android_bridge.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 virtual void Inspect(Profile* profile) const OVERRIDE; 401 virtual void Inspect(Profile* profile) const OVERRIDE;
402 virtual void Reload() const OVERRIDE; 402 virtual void Reload() const OVERRIDE;
403 403
404 void Navigate(const std::string& url, base::Closure callback) const; 404 void Navigate(const std::string& url, base::Closure callback) const;
405 405
406 private: 406 private:
407 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser_; 407 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser_;
408 std::string debug_url_; 408 std::string debug_url_;
409 std::string frontend_url_; 409 std::string frontend_url_;
410 std::string remote_id_; 410 std::string remote_id_;
411 std::string remote_type_;
411 DISALLOW_COPY_AND_ASSIGN(RemotePageTarget); 412 DISALLOW_COPY_AND_ASSIGN(RemotePageTarget);
412 }; 413 };
413 414
414 static std::string GetStringProperty(const base::DictionaryValue& value, 415 static std::string GetStringProperty(const base::DictionaryValue& value,
415 const std::string& name) { 416 const std::string& name) {
416 std::string result; 417 std::string result;
417 value.GetString(name, &result); 418 value.GetString(name, &result);
418 return result; 419 return result;
419 } 420 }
420 421
(...skipping 15 matching lines...) Expand all
436 } 437 }
437 438
438 RemotePageTarget::RemotePageTarget( 439 RemotePageTarget::RemotePageTarget(
439 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, 440 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser,
440 const base::DictionaryValue& value) 441 const base::DictionaryValue& value)
441 : DevToolsTargetImpl(AgentHostDelegate::GetOrCreateAgentHost( 442 : DevToolsTargetImpl(AgentHostDelegate::GetOrCreateAgentHost(
442 BuildUniqueTargetId(browser.get(), value), 443 BuildUniqueTargetId(browser.get(), value),
443 browser, GetDebugURL(value))), 444 browser, GetDebugURL(value))),
444 browser_(browser), 445 browser_(browser),
445 debug_url_(GetDebugURL(value)), 446 debug_url_(GetDebugURL(value)),
446 remote_id_(GetStringProperty(value, "id")) { 447 remote_id_(GetStringProperty(value, "id")),
448 remote_type_(GetStringProperty(value, "type")) {
447 set_type("adb_page"); 449 set_type("adb_page");
448 set_url(GURL(GetStringProperty(value, "url"))); 450 set_url(GURL(GetStringProperty(value, "url")));
449 set_title(base::UTF16ToUTF8(net::UnescapeForHTML(base::UTF8ToUTF16( 451 set_title(base::UTF16ToUTF8(net::UnescapeForHTML(base::UTF8ToUTF16(
450 GetStringProperty(value, "title"))))); 452 GetStringProperty(value, "title")))));
451 set_description(GetStringProperty(value, "description")); 453 set_description(GetStringProperty(value, "description"));
452 set_favicon_url(GURL(GetStringProperty(value, "faviconUrl"))); 454 set_favicon_url(GURL(GetStringProperty(value, "faviconUrl")));
453 debug_url_ = GetDebugURL(value); 455 debug_url_ = GetDebugURL(value);
454 frontend_url_ = GetStringProperty(value, "devtoolsFrontendUrl"); 456 frontend_url_ = GetStringProperty(value, "devtoolsFrontendUrl");
455 457
456 size_t ws_param = frontend_url_.find("?ws"); 458 size_t ws_param = frontend_url_.find("?ws");
(...skipping 19 matching lines...) Expand all
476 } 478 }
477 479
478 bool RemotePageTarget::IsAttached() const { 480 bool RemotePageTarget::IsAttached() const {
479 return debug_url_.empty(); 481 return debug_url_.empty();
480 } 482 }
481 483
482 static void NoOp(int, const std::string&) {} 484 static void NoOp(int, const std::string&) {}
483 485
484 void RemotePageTarget::Inspect(Profile* profile) const { 486 void RemotePageTarget::Inspect(Profile* profile) const {
485 Activate(); 487 Activate();
486 DevToolsWindow::OpenExternalFrontend(profile, frontend_url_, 488 bool isWorker = remote_type_ == "worker" || remote_type_ == "service_worker";
dgozman 2014/08/22 16:33:03 Please use constants from devtools_target_impl.
vkuzkokov 2014/08/25 15:11:38 Done.
487 GetAgentHost()); 489 DevToolsWindow::OpenExternalFrontend(profile, frontend_url_, GetAgentHost(),
490 isWorker);
488 } 491 }
489 492
490 bool RemotePageTarget::Activate() const { 493 bool RemotePageTarget::Activate() const {
491 std::string request = base::StringPrintf(kActivatePageRequest, 494 std::string request = base::StringPrintf(kActivatePageRequest,
492 remote_id_.c_str()); 495 remote_id_.c_str());
493 browser_->SendJsonRequest(request, base::Bind(&NoOp)); 496 browser_->SendJsonRequest(request, base::Bind(&NoOp));
494 return true; 497 return true;
495 } 498 }
496 499
497 bool RemotePageTarget::Close() const { 500 bool RemotePageTarget::Close() const {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 bool enabled; 888 bool enabled;
886 if (pref_value->GetAsBoolean(&enabled) && enabled) { 889 if (pref_value->GetAsBoolean(&enabled) && enabled) {
887 device_providers.push_back(new UsbDeviceProvider(profile_)); 890 device_providers.push_back(new UsbDeviceProvider(profile_));
888 } 891 }
889 device_manager_->SetDeviceProviders(device_providers); 892 device_manager_->SetDeviceProviders(device_providers);
890 if (!device_list_listeners_.empty()) { 893 if (!device_list_listeners_.empty()) {
891 StopDeviceListPolling(); 894 StopDeviceListPolling();
892 StartDeviceListPolling(); 895 StartDeviceListPolling();
893 } 896 }
894 } 897 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/devtools/devtools_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698