| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CLIENT_UTILS_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CLIENT_UTILS_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CLIENT_UTILS_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CLIENT_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "content/common/service_worker/service_worker_status_code.h" | 13 #include "content/common/service_worker/service_worker_status_code.h" |
| 14 #include "ui/base/mojo/window_open_disposition.mojom.h" |
| 14 | 15 |
| 15 class GURL; | 16 class GURL; |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| 19 class ServiceWorkerContextCore; | 20 class ServiceWorkerContextCore; |
| 20 class ServiceWorkerProviderHost; | 21 class ServiceWorkerProviderHost; |
| 21 class ServiceWorkerVersion; | 22 class ServiceWorkerVersion; |
| 22 struct ServiceWorkerClientInfo; | 23 struct ServiceWorkerClientInfo; |
| 23 struct ServiceWorkerClientQueryOptions; | 24 struct ServiceWorkerClientQueryOptions; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 // called with the client information on completion. | 37 // called with the client information on completion. |
| 37 void FocusWindowClient(ServiceWorkerProviderHost* provider_host, | 38 void FocusWindowClient(ServiceWorkerProviderHost* provider_host, |
| 38 const ClientCallback& callback); | 39 const ClientCallback& callback); |
| 39 | 40 |
| 40 // Opens a new window and navigates it to |url|. |callback| is called with the | 41 // Opens a new window and navigates it to |url|. |callback| is called with the |
| 41 // window's client information on completion. | 42 // window's client information on completion. |
| 42 void OpenWindow(const GURL& url, | 43 void OpenWindow(const GURL& url, |
| 43 const GURL& script_url, | 44 const GURL& script_url, |
| 44 int worker_process_id, | 45 int worker_process_id, |
| 45 const base::WeakPtr<ServiceWorkerContextCore>& context, | 46 const base::WeakPtr<ServiceWorkerContextCore>& context, |
| 47 WindowOpenDisposition disposition, |
| 46 const NavigationCallback& callback); | 48 const NavigationCallback& callback); |
| 47 | 49 |
| 48 // Navigates the client specified by |process_id| and |frame_id| to |url|. | 50 // Navigates the client specified by |process_id| and |frame_id| to |url|. |
| 49 // |callback| is called with the client information on completion. | 51 // |callback| is called with the client information on completion. |
| 50 void NavigateClient(const GURL& url, | 52 void NavigateClient(const GURL& url, |
| 51 const GURL& script_url, | 53 const GURL& script_url, |
| 52 int process_id, | 54 int process_id, |
| 53 int frame_id, | 55 int frame_id, |
| 54 const base::WeakPtr<ServiceWorkerContextCore>& context, | 56 const base::WeakPtr<ServiceWorkerContextCore>& context, |
| 55 const NavigationCallback& callback); | 57 const NavigationCallback& callback); |
| 56 | 58 |
| 57 // Gets the client specified by |provider_host|. |callback| is called with the | 59 // Gets the client specified by |provider_host|. |callback| is called with the |
| 58 // client information on completion. | 60 // client information on completion. |
| 59 void GetClient(ServiceWorkerProviderHost* provider_host, | 61 void GetClient(ServiceWorkerProviderHost* provider_host, |
| 60 const ClientCallback& callback); | 62 const ClientCallback& callback); |
| 61 | 63 |
| 62 // Collects clients matched with |options|. |callback| is called with the client | 64 // Collects clients matched with |options|. |callback| is called with the client |
| 63 // information sorted in MRU order (most recently focused order) on completion. | 65 // information sorted in MRU order (most recently focused order) on completion. |
| 64 void GetClients(const base::WeakPtr<ServiceWorkerVersion>& controller, | 66 void GetClients(const base::WeakPtr<ServiceWorkerVersion>& controller, |
| 65 const ServiceWorkerClientQueryOptions& options, | 67 const ServiceWorkerClientQueryOptions& options, |
| 66 const ClientsCallback& callback); | 68 const ClientsCallback& callback); |
| 67 | 69 |
| 68 } // namespace service_worker_client_utils | 70 } // namespace service_worker_client_utils |
| 69 | 71 |
| 70 } // namespace content | 72 } // namespace content |
| 71 | 73 |
| 72 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CLIENT_UTILS_H_ | 74 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CLIENT_UTILS_H_ |
| OLD | NEW |