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

Side by Side Diff: content/browser/service_worker/service_worker_internals_ui.cc

Issue 817653002: Split EmbeddedWorkerDevToolsManager into two for Shared- and ServiceWorker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + indent fixes Created 5 years, 12 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 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 "content/browser/service_worker/service_worker_internals_ui.h" 5 #include "content/browser/service_worker/service_worker_internals_ui.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "content/browser/devtools/devtools_agent_host_impl.h" 14 #include "content/browser/devtools/devtools_agent_host_impl.h"
15 #include "content/browser/devtools/embedded_worker_devtools_manager.h" 15 #include "content/browser/devtools/service_worker_devtools_manager.h"
16 #include "content/browser/service_worker/service_worker_context_observer.h" 16 #include "content/browser/service_worker/service_worker_context_observer.h"
17 #include "content/browser/service_worker/service_worker_context_wrapper.h" 17 #include "content/browser/service_worker/service_worker_context_wrapper.h"
18 #include "content/browser/service_worker/service_worker_registration.h" 18 #include "content/browser/service_worker/service_worker_registration.h"
19 #include "content/browser/service_worker/service_worker_version.h" 19 #include "content/browser/service_worker/service_worker_version.h"
20 #include "content/grit/content_resources.h" 20 #include "content/grit/content_resources.h"
21 #include "content/public/browser/browser_context.h" 21 #include "content/public/browser/browser_context.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/storage_partition.h" 23 #include "content/public/browser/storage_partition.h"
24 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
25 #include "content/public/browser/web_ui.h" 25 #include "content/public/browser/web_ui.h"
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // ForEachStoragePartition is synchronous. 450 // ForEachStoragePartition is synchronous.
451 BrowserContext::StoragePartitionCallback remove_observer_cb = 451 BrowserContext::StoragePartitionCallback remove_observer_cb =
452 base::Bind(&ServiceWorkerInternalsUI::RemoveObserverFromStoragePartition, 452 base::Bind(&ServiceWorkerInternalsUI::RemoveObserverFromStoragePartition,
453 base::Unretained(this)); 453 base::Unretained(this));
454 BrowserContext::ForEachStoragePartition(browser_context, remove_observer_cb); 454 BrowserContext::ForEachStoragePartition(browser_context, remove_observer_cb);
455 } 455 }
456 456
457 void ServiceWorkerInternalsUI::GetOptions(const ListValue* args) { 457 void ServiceWorkerInternalsUI::GetOptions(const ListValue* args) {
458 DictionaryValue options; 458 DictionaryValue options;
459 options.SetBoolean("debug_on_start", 459 options.SetBoolean("debug_on_start",
460 EmbeddedWorkerDevToolsManager::GetInstance() 460 ServiceWorkerDevToolsManager::GetInstance()
461 ->debug_service_worker_on_start()); 461 ->debug_service_worker_on_start());
462 web_ui()->CallJavascriptFunction("serviceworker.onOptions", options); 462 web_ui()->CallJavascriptFunction("serviceworker.onOptions", options);
463 } 463 }
464 464
465 void ServiceWorkerInternalsUI::SetOption(const ListValue* args) { 465 void ServiceWorkerInternalsUI::SetOption(const ListValue* args) {
466 std::string option_name; 466 std::string option_name;
467 bool option_boolean; 467 bool option_boolean;
468 if (!args->GetString(0, &option_name) || option_name != "debug_on_start" || 468 if (!args->GetString(0, &option_name) || option_name != "debug_on_start" ||
469 !args->GetBoolean(1, &option_boolean)) { 469 !args->GetBoolean(1, &option_boolean)) {
470 return; 470 return;
471 } 471 }
472 EmbeddedWorkerDevToolsManager::GetInstance() 472 ServiceWorkerDevToolsManager::GetInstance()
473 ->set_debug_service_worker_on_start(option_boolean); 473 ->set_debug_service_worker_on_start(option_boolean);
474 } 474 }
475 475
476 void ServiceWorkerInternalsUI::GetAllRegistrations(const ListValue* args) { 476 void ServiceWorkerInternalsUI::GetAllRegistrations(const ListValue* args) {
477 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 477 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
478 BrowserContext* browser_context = 478 BrowserContext* browser_context =
479 web_ui()->GetWebContents()->GetBrowserContext(); 479 web_ui()->GetWebContents()->GetBrowserContext();
480 // Safe to use base::Unretained(this) because 480 // Safe to use base::Unretained(this) because
481 // ForEachStoragePartition is synchronous. 481 // ForEachStoragePartition is synchronous.
482 BrowserContext::StoragePartitionCallback add_context_cb = 482 BrowserContext::StoragePartitionCallback add_context_cb =
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 if (!args->GetInteger(0, &callback_id) || 616 if (!args->GetInteger(0, &callback_id) ||
617 !args->GetDictionary(1, &cmd_args) || 617 !args->GetDictionary(1, &cmd_args) ||
618 !cmd_args->GetInteger("process_id", &process_id) || 618 !cmd_args->GetInteger("process_id", &process_id) ||
619 !cmd_args->GetInteger("devtools_agent_route_id", 619 !cmd_args->GetInteger("devtools_agent_route_id",
620 &devtools_agent_route_id)) { 620 &devtools_agent_route_id)) {
621 return; 621 return;
622 } 622 }
623 base::Callback<void(ServiceWorkerStatusCode)> callback = 623 base::Callback<void(ServiceWorkerStatusCode)> callback =
624 base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id); 624 base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id);
625 scoped_refptr<DevToolsAgentHostImpl> agent_host( 625 scoped_refptr<DevToolsAgentHostImpl> agent_host(
626 EmbeddedWorkerDevToolsManager::GetInstance() 626 ServiceWorkerDevToolsManager::GetInstance()
627 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); 627 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id));
628 if (!agent_host.get()) { 628 if (!agent_host.get()) {
629 callback.Run(SERVICE_WORKER_ERROR_NOT_FOUND); 629 callback.Run(SERVICE_WORKER_ERROR_NOT_FOUND);
630 return; 630 return;
631 } 631 }
632 agent_host->Inspect(web_ui()->GetWebContents()->GetBrowserContext()); 632 agent_host->Inspect(web_ui()->GetWebContents()->GetBrowserContext());
633 callback.Run(SERVICE_WORKER_OK); 633 callback.Run(SERVICE_WORKER_OK);
634 } 634 }
635 635
636 void ServiceWorkerInternalsUI::Unregister(const ListValue* args) { 636 void ServiceWorkerInternalsUI::Unregister(const ListValue* args) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 return; 668 return;
669 } 669 }
670 670
671 base::Callback<void(ServiceWorkerStatusCode)> callback = 671 base::Callback<void(ServiceWorkerStatusCode)> callback =
672 base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id); 672 base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id);
673 FindRegistrationForPattern( 673 FindRegistrationForPattern(
674 context, GURL(scope_string), base::Bind(StartActiveWorker, callback)); 674 context, GURL(scope_string), base::Bind(StartActiveWorker, callback));
675 } 675 }
676 676
677 } // namespace content 677 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/embedded_worker_instance.cc ('k') | content/browser/shared_worker/shared_worker_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698