| OLD | NEW |
| 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 #ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_H_ |
| 6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_H_ | 6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/public/common/manifest.h" | 12 #include "content/public/common/manifest.h" |
| 13 #include "content/public/renderer/render_frame_observer.h" | 13 #include "content/public/renderer/render_frame_observer.h" |
| 14 | 14 |
| 15 class GURL; |
| 16 |
| 15 namespace blink { | 17 namespace blink { |
| 16 class WebURLResponse; | 18 class WebURLResponse; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace content { | 21 namespace content { |
| 20 | 22 |
| 21 class ManifestFetcher; | 23 class ManifestFetcher; |
| 22 | 24 |
| 23 // The ManifestManager is a helper class that takes care of fetching and parsing | 25 // The ManifestManager is a helper class that takes care of fetching and parsing |
| 24 // the Manifest of the associated RenderFrame. It uses the ManifestFetcher and | 26 // the Manifest of the associated RenderFrame. It uses the ManifestFetcher and |
| (...skipping 21 matching lines...) Expand all Loading... |
| 46 ResolveStateSuccess, | 48 ResolveStateSuccess, |
| 47 ResolveStateFailure | 49 ResolveStateFailure |
| 48 }; | 50 }; |
| 49 | 51 |
| 50 // Called when receiving a ManifestManagerMsg_RequestManifest from the browser | 52 // Called when receiving a ManifestManagerMsg_RequestManifest from the browser |
| 51 // process. | 53 // process. |
| 52 void OnRequestManifest(int request_id); | 54 void OnRequestManifest(int request_id); |
| 53 void OnRequestManifestComplete(int request_id, const Manifest&); | 55 void OnRequestManifestComplete(int request_id, const Manifest&); |
| 54 | 56 |
| 55 void FetchManifest(); | 57 void FetchManifest(); |
| 56 void OnManifestFetchComplete(const blink::WebURLResponse& response, | 58 void OnManifestFetchComplete(const GURL& document_url, |
| 59 const blink::WebURLResponse& response, |
| 57 const std::string& data); | 60 const std::string& data); |
| 58 void ResolveCallbacks(ResolveState state); | 61 void ResolveCallbacks(ResolveState state); |
| 59 | 62 |
| 60 scoped_ptr<ManifestFetcher> fetcher_; | 63 scoped_ptr<ManifestFetcher> fetcher_; |
| 61 | 64 |
| 62 // Whether the RenderFrame may have an associated Manifest. If true, the frame | 65 // Whether the RenderFrame may have an associated Manifest. If true, the frame |
| 63 // may have a manifest, if false, it can't have one. This boolean is true when | 66 // may have a manifest, if false, it can't have one. This boolean is true when |
| 64 // DidChangeManifest() is called, if it is never called, it means that the | 67 // DidChangeManifest() is called, if it is never called, it means that the |
| 65 // associated document has no <link rel='manifest'>. | 68 // associated document has no <link rel='manifest'>. |
| 66 bool may_have_manifest_; | 69 bool may_have_manifest_; |
| 67 | 70 |
| 68 // Whether the current Manifest is dirty. | 71 // Whether the current Manifest is dirty. |
| 69 bool manifest_dirty_; | 72 bool manifest_dirty_; |
| 70 | 73 |
| 71 // Current Manifest. Might be outdated if manifest_dirty_ is true. | 74 // Current Manifest. Might be outdated if manifest_dirty_ is true. |
| 72 Manifest manifest_; | 75 Manifest manifest_; |
| 73 | 76 |
| 74 std::list<GetManifestCallback> pending_callbacks_; | 77 std::list<GetManifestCallback> pending_callbacks_; |
| 75 | 78 |
| 76 DISALLOW_COPY_AND_ASSIGN(ManifestManager); | 79 DISALLOW_COPY_AND_ASSIGN(ManifestManager); |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 } // namespace content | 82 } // namespace content |
| 80 | 83 |
| 81 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_H_ | 84 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_H_ |
| OLD | NEW |