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

Side by Side Diff: content/browser/service_worker/service_worker_version.h

Issue 2376403004: Store Origin-Trial tokens to ServiceWorkerDataBase (Closed)
Patch Set: incorporated chasej's comment Created 4 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_VERSION_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <functional> 10 #include <functional>
(...skipping 15 matching lines...) Expand all
26 #include "base/observer_list.h" 26 #include "base/observer_list.h"
27 #include "base/optional.h" 27 #include "base/optional.h"
28 #include "base/threading/thread_task_runner_handle.h" 28 #include "base/threading/thread_task_runner_handle.h"
29 #include "base/time/time.h" 29 #include "base/time/time.h"
30 #include "base/timer/timer.h" 30 #include "base/timer/timer.h"
31 #include "content/browser/service_worker/embedded_worker_instance.h" 31 #include "content/browser/service_worker/embedded_worker_instance.h"
32 #include "content/browser/service_worker/embedded_worker_status.h" 32 #include "content/browser/service_worker/embedded_worker_status.h"
33 #include "content/browser/service_worker/service_worker_metrics.h" 33 #include "content/browser/service_worker/service_worker_metrics.h"
34 #include "content/browser/service_worker/service_worker_script_cache_map.h" 34 #include "content/browser/service_worker/service_worker_script_cache_map.h"
35 #include "content/common/content_export.h" 35 #include "content/common/content_export.h"
36 #include "content/common/origin_trials/trial_token_validator.h"
36 #include "content/common/service_worker/service_worker_status_code.h" 37 #include "content/common/service_worker/service_worker_status_code.h"
37 #include "content/common/service_worker/service_worker_types.h" 38 #include "content/common/service_worker/service_worker_types.h"
38 #include "ipc/ipc_message.h" 39 #include "ipc/ipc_message.h"
39 #include "mojo/public/cpp/bindings/interface_ptr.h" 40 #include "mojo/public/cpp/bindings/interface_ptr.h"
40 #include "services/shell/public/cpp/interface_provider.h" 41 #include "services/shell/public/cpp/interface_provider.h"
41 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerEventResult.h" 42 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerEventResult.h"
42 #include "url/gurl.h" 43 #include "url/gurl.h"
43 #include "url/origin.h" 44 #include "url/origin.h"
44 45
45 // Windows headers will redefine SendMessage. 46 // Windows headers will redefine SendMessage.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 347 }
347 void set_force_bypass_cache_for_scripts(bool force_bypass_cache_for_scripts) { 348 void set_force_bypass_cache_for_scripts(bool force_bypass_cache_for_scripts) {
348 force_bypass_cache_for_scripts_ = force_bypass_cache_for_scripts; 349 force_bypass_cache_for_scripts_ = force_bypass_cache_for_scripts;
349 } 350 }
350 351
351 bool pause_after_download() const { return pause_after_download_; } 352 bool pause_after_download() const { return pause_after_download_; }
352 void set_pause_after_download(bool pause_after_download) { 353 void set_pause_after_download(bool pause_after_download) {
353 pause_after_download_ = pause_after_download; 354 pause_after_download_ = pause_after_download;
354 } 355 }
355 356
357 // Returns nullptr if the main script is not loaded yet and:
358 // 1) The worer is a new one.
falken 2016/10/07 03:35:22 nit: worker
horo 2016/10/07 05:33:32 Done.
359 // OR
360 // 2) The worker is an existing one but the entry in ServiceWorkerDatabase
361 // was written by old version Chrome, so |origin_trial_tokens| wasn't set
falken 2016/10/07 03:35:22 and old version of Chrome (< M55)
horo 2016/10/07 05:33:32 Done.
362 // in the entry.
363 const TrialTokenValidator::FeatureToTokensMap* origin_trial_tokens() const {
364 return origin_trial_tokens_.get();
365 }
366 // Set valid tokens in |tokens|. Invalid tokens in |tokens| are ignored.
367 void SetValidOriginTrialTokens(
368 const TrialTokenValidator::FeatureToTokensMap& tokens);
369
356 void SetDevToolsAttached(bool attached); 370 void SetDevToolsAttached(bool attached);
357 371
358 // Sets the HttpResponseInfo used to load the main script. 372 // Sets the HttpResponseInfo used to load the main script.
359 // This HttpResponseInfo will be used for all responses sent back from the 373 // This HttpResponseInfo will be used for all responses sent back from the
360 // service worker, as the effective security of these responses is equivalent 374 // service worker, as the effective security of these responses is equivalent
361 // to that of the ServiceWorker. 375 // to that of the ServiceWorker.
362 void SetMainScriptHttpResponseInfo(const net::HttpResponseInfo& http_info); 376 void SetMainScriptHttpResponseInfo(const net::HttpResponseInfo& http_info);
363 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo(); 377 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo();
364 378
365 // Simulate ping timeout. Should be used for tests-only. 379 // Simulate ping timeout. Should be used for tests-only.
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 bool skip_waiting_ = false; 755 bool skip_waiting_ = false;
742 bool skip_recording_startup_time_ = false; 756 bool skip_recording_startup_time_ = false;
743 bool force_bypass_cache_for_scripts_ = false; 757 bool force_bypass_cache_for_scripts_ = false;
744 bool pause_after_download_ = false; 758 bool pause_after_download_ = false;
745 bool is_update_scheduled_ = false; 759 bool is_update_scheduled_ = false;
746 bool in_dtor_ = false; 760 bool in_dtor_ = false;
747 761
748 std::vector<int> pending_skip_waiting_requests_; 762 std::vector<int> pending_skip_waiting_requests_;
749 std::unique_ptr<net::HttpResponseInfo> main_script_http_info_; 763 std::unique_ptr<net::HttpResponseInfo> main_script_http_info_;
750 764
765 std::unique_ptr<TrialTokenValidator::FeatureToTokensMap> origin_trial_tokens_;
766
751 // If not OK, the reason that StartWorker failed. Used for 767 // If not OK, the reason that StartWorker failed. Used for
752 // running |start_callbacks_|. 768 // running |start_callbacks_|.
753 ServiceWorkerStatusCode start_worker_status_ = SERVICE_WORKER_OK; 769 ServiceWorkerStatusCode start_worker_status_ = SERVICE_WORKER_OK;
754 770
755 std::unique_ptr<PingController> ping_controller_; 771 std::unique_ptr<PingController> ping_controller_;
756 std::unique_ptr<Metrics> metrics_; 772 std::unique_ptr<Metrics> metrics_;
757 const bool should_exclude_from_uma_ = false; 773 const bool should_exclude_from_uma_ = false;
758 774
759 bool stop_when_devtools_detached_ = false; 775 bool stop_when_devtools_detached_ = false;
760 776
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 854
839 // At this point |this| can have been deleted, so don't do anything other 855 // At this point |this| can have been deleted, so don't do anything other
840 // than returning. 856 // than returning.
841 857
842 return true; 858 return true;
843 } 859 }
844 860
845 } // namespace content 861 } // namespace content
846 862
847 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 863 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698