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

Side by Side Diff: extensions/renderer/guest_view/mime_handler_view_container.h

Issue 701713003: Support embedded plugins with MimeHandlerView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-guest-view-container
Patch Set: Created 6 years, 1 month 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 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 EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_ 5 #ifndef EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_
6 #define EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_ 6 #define EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_
7 7
8 #include "extensions/renderer/guest_view/guest_view_container.h" 8 #include "extensions/renderer/guest_view/guest_view_container.h"
9 #include "third_party/WebKit/public/platform/WebURLLoader.h"
10 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
11 #include "url/gurl.h"
9 12
10 namespace extensions { 13 namespace extensions {
11 14
12 class MimeHandlerViewContainer : public GuestViewContainer { 15 class MimeHandlerViewContainer : public GuestViewContainer,
16 public blink::WebURLLoaderClient {
13 public: 17 public:
14 MimeHandlerViewContainer(content::RenderFrame* render_frame, 18 MimeHandlerViewContainer(content::RenderFrame* render_frame,
15 const std::string& mime_type); 19 const std::string& mime_type,
20 const GURL& original_url);
16 ~MimeHandlerViewContainer() override; 21 ~MimeHandlerViewContainer() override;
17 22
18 // BrowserPluginDelegate implementation. 23 // BrowserPluginDelegate implementation.
19 void DidFinishLoading() override; 24 void DidFinishLoading() override;
20 void DidReceiveData(const char* data, int data_length) override; 25 void DidReceiveData(const char* data, int data_length) override;
26 void Ready() override;
21 27
22 // GuestViewContainer override. 28 // GuestViewContainer overrides.
23 bool HandlesMessage(const IPC::Message& message) override; 29 bool HandlesMessage(const IPC::Message& message) override;
24 bool OnMessage(const IPC::Message& message) override; 30 bool OnMessage(const IPC::Message& message) override;
25 31
32 // WebURLLoaderClient overrides.
33 void didReceiveData(blink::WebURLLoader* loader,
34 const char* data,
35 int data_length,
36 int encoded_data_length) override;
37 void didFinishLoading(blink::WebURLLoader* loader,
38 double finish_time,
39 int64_t total_encoded_data_length) override;
40
26 private: 41 private:
42 // Message handlers.
27 void OnCreateMimeHandlerViewGuestACK(int element_instance_id); 43 void OnCreateMimeHandlerViewGuestACK(int element_instance_id);
28 44
45 void CreateMimeHandlerViewGuest();
46
47 // The MIME type of the plugin.
29 const std::string mime_type_; 48 const std::string mime_type_;
49
50 // The URL of the extension to navigate to.
30 std::string html_string_; 51 std::string html_string_;
31 52
53 // Whether the plugin is embedded or not.
54 bool is_embedded_;
55
56 // The original URL of the plugin.
57 GURL original_url_;
58
59 // A URL loader to load the |original_url_| when the plugin is embedded. In
60 // the embedded case, no URL request is made automatically.
61 scoped_ptr<blink::WebURLLoader> loader_;
62
32 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewContainer); 63 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewContainer);
33 }; 64 };
34 65
35 } // namespace extensions 66 } // namespace extensions
36 67
37 #endif // EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_ 68 #endif // EXTENSIONS_RENDERER_GUEST_VIEW_MIME_HANDLER_VIEW_CONTAINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698