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

Side by Side Diff: extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc

Issue 598173003: Run clang-modernize -use-nullptr over src/extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h" 5 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/render_process_host.h" 9 #include "content/public/browser/render_process_host.h"
10 #include "content/public/common/url_constants.h" 10 #include "content/public/common/url_constants.h"
(...skipping 13 matching lines...) Expand all
24 namespace extensions { 24 namespace extensions {
25 25
26 // static 26 // static
27 const char MimeHandlerViewGuest::Type[] = "mimehandler"; 27 const char MimeHandlerViewGuest::Type[] = "mimehandler";
28 28
29 // static 29 // static
30 GuestViewBase* MimeHandlerViewGuest::Create( 30 GuestViewBase* MimeHandlerViewGuest::Create(
31 content::BrowserContext* browser_context, 31 content::BrowserContext* browser_context,
32 int guest_instance_id) { 32 int guest_instance_id) {
33 if (!extensions::FeatureSwitch::mime_handler_view()->IsEnabled()) 33 if (!extensions::FeatureSwitch::mime_handler_view()->IsEnabled())
34 return NULL; 34 return nullptr;
35 35
36 return new MimeHandlerViewGuest(browser_context, guest_instance_id); 36 return new MimeHandlerViewGuest(browser_context, guest_instance_id);
37 } 37 }
38 38
39 MimeHandlerViewGuest::MimeHandlerViewGuest( 39 MimeHandlerViewGuest::MimeHandlerViewGuest(
40 content::BrowserContext* browser_context, 40 content::BrowserContext* browser_context,
41 int guest_instance_id) 41 int guest_instance_id)
42 : GuestView<MimeHandlerViewGuest>(browser_context, guest_instance_id), 42 : GuestView<MimeHandlerViewGuest>(browser_context, guest_instance_id),
43 delegate_(ExtensionsAPIClient::Get()->CreateMimeHandlerViewGuestDelegate( 43 delegate_(ExtensionsAPIClient::Get()->CreateMimeHandlerViewGuestDelegate(
44 this)) { 44 this)) {
(...skipping 19 matching lines...) Expand all
64 std::string orig_mime_type; 64 std::string orig_mime_type;
65 create_params.GetString(mime_handler_view::kMimeType, &orig_mime_type); 65 create_params.GetString(mime_handler_view::kMimeType, &orig_mime_type);
66 DCHECK(!orig_mime_type.empty()); 66 DCHECK(!orig_mime_type.empty());
67 67
68 std::string extension_src; 68 std::string extension_src;
69 create_params.GetString(mime_handler_view::kSrc, &extension_src); 69 create_params.GetString(mime_handler_view::kSrc, &extension_src);
70 DCHECK(!extension_src.empty()); 70 DCHECK(!extension_src.empty());
71 71
72 GURL mime_handler_extension_url(extension_src); 72 GURL mime_handler_extension_url(extension_src);
73 if (!mime_handler_extension_url.is_valid()) { 73 if (!mime_handler_extension_url.is_valid()) {
74 callback.Run(NULL); 74 callback.Run(nullptr);
75 return; 75 return;
76 } 76 }
77 77
78 const Extension* mime_handler_extension = 78 const Extension* mime_handler_extension =
79 // TODO(lazyboy): Do we need handle the case where the extension is 79 // TODO(lazyboy): Do we need handle the case where the extension is
80 // terminated (ExtensionRegistry::TERMINATED)? 80 // terminated (ExtensionRegistry::TERMINATED)?
81 ExtensionRegistry::Get(browser_context())->enabled_extensions().GetByID( 81 ExtensionRegistry::Get(browser_context())->enabled_extensions().GetByID(
82 mime_handler_extension_url.host()); 82 mime_handler_extension_url.host());
83 if (!mime_handler_extension) { 83 if (!mime_handler_extension) {
84 LOG(ERROR) << "Extension for mime_type not found, mime_type = " 84 LOG(ERROR) << "Extension for mime_type not found, mime_type = "
85 << orig_mime_type; 85 << orig_mime_type;
86 callback.Run(NULL); 86 callback.Run(nullptr);
87 return; 87 return;
88 } 88 }
89 89
90 ProcessManager* process_manager = 90 ProcessManager* process_manager =
91 ExtensionSystem::Get(browser_context())->process_manager(); 91 ExtensionSystem::Get(browser_context())->process_manager();
92 DCHECK(process_manager); 92 DCHECK(process_manager);
93 93
94 // Use the mime handler extension's SiteInstance to create the guest so it 94 // Use the mime handler extension's SiteInstance to create the guest so it
95 // goes under the same process as the extension. 95 // goes under the same process as the extension.
96 content::SiteInstance* guest_site_instance = 96 content::SiteInstance* guest_site_instance =
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // TODO(fsamuel): This introduces the possibility of out-of-order keyboard 128 // TODO(fsamuel): This introduces the possibility of out-of-order keyboard
129 // events because the guest may be arbitrarily delayed when responding to 129 // events because the guest may be arbitrarily delayed when responding to
130 // keyboard events. In that time, the embedder may have received and processed 130 // keyboard events. In that time, the embedder may have received and processed
131 // additional key events. This needs to be fixed as soon as possible. 131 // additional key events. This needs to be fixed as soon as possible.
132 // See http://crbug.com/229882. 132 // See http://crbug.com/229882.
133 embedder_web_contents()->GetDelegate()->HandleKeyboardEvent(web_contents(), 133 embedder_web_contents()->GetDelegate()->HandleKeyboardEvent(web_contents(),
134 event); 134 event);
135 } 135 }
136 136
137 } // namespace extensions 137 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698