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

Side by Side Diff: chrome/browser/guest_view/guest_view_base.cc

Issue 376033002: Adding MimeHandlerView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pending-zork-patch2
Patch Set: sync @tott Created 6 years, 5 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
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 #include "chrome/browser/guest_view/guest_view_base.h" 5 #include "chrome/browser/guest_view/guest_view_base.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/guest_view/app_view/app_view_guest.h" 10 #include "chrome/browser/guest_view/app_view/app_view_guest.h"
11 #include "chrome/browser/guest_view/guest_view_constants.h" 11 #include "chrome/browser/guest_view/guest_view_constants.h"
12 #include "chrome/browser/guest_view/guest_view_manager.h" 12 #include "chrome/browser/guest_view/guest_view_manager.h"
13 #include "chrome/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
13 #include "chrome/browser/guest_view/web_view/web_view_guest.h" 14 #include "chrome/browser/guest_view/web_view/web_view_guest.h"
14 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/content_settings.h" 16 #include "chrome/common/content_settings.h"
16 #include "content/public/browser/render_frame_host.h" 17 #include "content/public/browser/render_frame_host.h"
17 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "content/public/common/url_constants.h" 21 #include "content/public/common/url_constants.h"
21 #include "extensions/browser/event_router.h" 22 #include "extensions/browser/event_router.h"
22 #include "third_party/WebKit/public/web/WebInputEvent.h" 23 #include "third_party/WebKit/public/web/WebInputEvent.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 int guest_instance_id, 146 int guest_instance_id,
146 const std::string& view_type) { 147 const std::string& view_type) {
147 if (view_type == WebViewGuest::Type) { 148 if (view_type == WebViewGuest::Type) {
148 return new WebViewGuest(browser_context, guest_instance_id); 149 return new WebViewGuest(browser_context, guest_instance_id);
149 } else if (view_type == AppViewGuest::Type) { 150 } else if (view_type == AppViewGuest::Type) {
150 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 151 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
151 switches::kEnableAppView)) { 152 switches::kEnableAppView)) {
152 return NULL; 153 return NULL;
153 } 154 }
154 return new AppViewGuest(browser_context, guest_instance_id); 155 return new AppViewGuest(browser_context, guest_instance_id);
156 } else if (view_type == MimeHandlerViewGuest::Type) {
157 // TODO(lazyboy): Guard this with a flag initially.
158 return new MimeHandlerViewGuest(browser_context, guest_instance_id);
155 } 159 }
156 NOTREACHED(); 160 NOTREACHED();
157 return NULL; 161 return NULL;
158 } 162 }
159 163
160 // static 164 // static
161 GuestViewBase* GuestViewBase::FromWebContents(WebContents* web_contents) { 165 GuestViewBase* GuestViewBase::FromWebContents(WebContents* web_contents) {
162 WebContentsGuestViewMap* guest_map = webcontents_guestview_map.Pointer(); 166 WebContentsGuestViewMap* guest_map = webcontents_guestview_map.Pointer();
163 WebContentsGuestViewMap::iterator it = guest_map->find(web_contents); 167 WebContentsGuestViewMap::iterator it = guest_map->find(web_contents);
164 return it == guest_map->end() ? NULL : it->second; 168 return it == guest_map->end() ? NULL : it->second;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // purpose. Let's self-destruct. 368 // purpose. Let's self-destruct.
365 delete this; 369 delete this;
366 callback.Run(NULL); 370 callback.Run(NULL);
367 return; 371 return;
368 } 372 }
369 InitWithWebContents(embedder_extension_id, 373 InitWithWebContents(embedder_extension_id,
370 embedder_render_process_id, 374 embedder_render_process_id,
371 guest_web_contents); 375 guest_web_contents);
372 callback.Run(guest_web_contents); 376 callback.Run(guest_web_contents);
373 } 377 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698