| 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_HOST_H_ | 5 #ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_HOST_H_ |
| 6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_HOST_H_ | 6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_HOST_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 typedef base::Callback<void(const Manifest&)> GetManifestCallback; | 37 typedef base::Callback<void(const Manifest&)> GetManifestCallback; |
| 38 | 38 |
| 39 // Calls the given callback with the manifest associated with the | 39 // Calls the given callback with the manifest associated with the |
| 40 // given RenderFrameHost. If the frame has no manifest or if getting it failed | 40 // given RenderFrameHost. If the frame has no manifest or if getting it failed |
| 41 // the callback will have an empty manifest. | 41 // the callback will have an empty manifest. |
| 42 void GetManifest(RenderFrameHost*, const GetManifestCallback&); | 42 void GetManifest(RenderFrameHost*, const GetManifestCallback&); |
| 43 | 43 |
| 44 // WebContentsObserver | 44 // WebContentsObserver |
| 45 virtual bool OnMessageReceived(const IPC::Message&, | 45 virtual bool OnMessageReceived(const IPC::Message&, |
| 46 RenderFrameHost*) OVERRIDE; | 46 RenderFrameHost*) override; |
| 47 virtual void RenderFrameDeleted(RenderFrameHost*) OVERRIDE; | 47 virtual void RenderFrameDeleted(RenderFrameHost*) override; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 typedef IDMap<GetManifestCallback, IDMapOwnPointer> CallbackMap; | 50 typedef IDMap<GetManifestCallback, IDMapOwnPointer> CallbackMap; |
| 51 typedef base::hash_map<RenderFrameHost*, CallbackMap*> FrameCallbackMap; | 51 typedef base::hash_map<RenderFrameHost*, CallbackMap*> FrameCallbackMap; |
| 52 | 52 |
| 53 void OnRequestManifestResponse( | 53 void OnRequestManifestResponse( |
| 54 RenderFrameHost*, int request_id, const Manifest&); | 54 RenderFrameHost*, int request_id, const Manifest&); |
| 55 | 55 |
| 56 // Returns the CallbackMap associated with the given RenderFrameHost, or null. | 56 // Returns the CallbackMap associated with the given RenderFrameHost, or null. |
| 57 CallbackMap* GetCallbackMapForFrame(RenderFrameHost*); | 57 CallbackMap* GetCallbackMapForFrame(RenderFrameHost*); |
| 58 | 58 |
| 59 FrameCallbackMap pending_callbacks_; | 59 FrameCallbackMap pending_callbacks_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(ManifestManagerHost); | 61 DISALLOW_COPY_AND_ASSIGN(ManifestManagerHost); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace content | 64 } // namespace content |
| 65 | 65 |
| 66 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_HOST_H_ | 66 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_HOST_H_ |
| OLD | NEW |