| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef EXTENSIONS_BROWSER_LAZY_CONTEXT_ID_H_ |
| 6 #define EXTENSIONS_BROWSER_LAZY_CONTEXT_ID_H_ |
| 7 |
| 8 #include "extensions/common/extension_id.h" |
| 9 #include "url/gurl.h" |
| 10 |
| 11 namespace content { |
| 12 class BrowserContext; |
| 13 } |
| 14 |
| 15 namespace extensions { |
| 16 class LazyBackgroundTaskQueue; |
| 17 |
| 18 class LazyContextId { |
| 19 public: |
| 20 enum class Type { |
| 21 kEventPage, |
| 22 }; |
| 23 |
| 24 // An event page (lazy background) context. |
| 25 LazyContextId(content::BrowserContext* context, |
| 26 const ExtensionId& extension_id); |
| 27 // TODO(lazyboy): Service worker context. |
| 28 |
| 29 bool is_for_event_page() const { return type_ == Type::kEventPage; } |
| 30 |
| 31 content::BrowserContext* browser_context() const { return context_; } |
| 32 void set_browser_context(content::BrowserContext* context) { |
| 33 context_ = context; |
| 34 } |
| 35 |
| 36 const ExtensionId& extension_id() const { return extension_id_; } |
| 37 |
| 38 // TODO(lazyboy): Use a generic interface to support service workers. |
| 39 LazyBackgroundTaskQueue* GetTaskQueue(); |
| 40 |
| 41 private: |
| 42 const Type type_; |
| 43 content::BrowserContext* context_; |
| 44 const ExtensionId extension_id_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(LazyContextId); |
| 47 }; |
| 48 |
| 49 } // namespace extensions |
| 50 |
| 51 #endif // EXTENSIONS_BROWSER_LAZY_CONTEXT_ID_H_ |
| OLD | NEW |