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

Side by Side Diff: content/browser/manifest/manifest_manager_host.h

Issue 537053002: Implement ManifestManager to handle manifest in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@manifest_fetcher
Patch Set: with tests Created 6 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_HOST_H_
6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_HOST_H_
7
8 #include "base/callback_forward.h"
9 #include "base/id_map.h"
10 #include "content/public/browser/web_contents_observer.h"
11
12 namespace content {
13
14 class RenderFrameHost;
15 class WebContents;
16 struct Manifest;
17
18 // ManifestManagerHost is a helper class that allows callers to get the Manifest
19 // associated with a frame. It handles the IPC messaging with the child process.
20 // TODO(mlamouri): keep a cached version and a dirty bit here.
21 class ManifestManagerHost : public WebContentsObserver {
22 public:
23 explicit ManifestManagerHost(WebContents* web_contents);
24 virtual ~ManifestManagerHost();
25
26 typedef base::Callback<void(const Manifest&)> GetManifestCallback;
27
28 // Calls the given callback with the manifest associated with the
29 // given RenderFrameHost. If the frame has no manifest or if getting it failed
30 // the callback will have an empty manifest.
31 void GetManifest(RenderFrameHost*, const GetManifestCallback&);
32
33 // WebContentsObserver
34 virtual bool OnMessageReceived(const IPC::Message&,
35 RenderFrameHost*) OVERRIDE;
36
37 private:
38 void OnRequestManifestResponse(int request_id, const Manifest& manifest);
39
40 typedef IDMap<GetManifestCallback, IDMapOwnPointer> CallbackMap;
41 CallbackMap pending_callbacks_;
42
43 DISALLOW_COPY_AND_ASSIGN(ManifestManagerHost);
44 };
45
46 } // namespace content
47
48 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_MANAGER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698