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

Side by Side Diff: extensions/browser/guest_view/extension_options/extension_options_guest.cc

Issue 1641563002: Remove linked_ptr usage in //base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase, really Created 4 years, 10 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/extension_options/extension_options_gues t.h" 5 #include "extensions/browser/guest_view/extension_options/extension_options_gues t.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "components/crx_file/id_util.h" 10 #include "components/crx_file/id_util.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 const base::DictionaryValue& create_params) { 120 const base::DictionaryValue& create_params) {
121 ExtensionsAPIClient::Get()->AttachWebContentsHelpers(web_contents()); 121 ExtensionsAPIClient::Get()->AttachWebContentsHelpers(web_contents());
122 web_contents()->GetController().LoadURL(options_page_, 122 web_contents()->GetController().LoadURL(options_page_,
123 content::Referrer(), 123 content::Referrer(),
124 ui::PAGE_TRANSITION_LINK, 124 ui::PAGE_TRANSITION_LINK,
125 std::string()); 125 std::string());
126 } 126 }
127 127
128 void ExtensionOptionsGuest::GuestViewDidStopLoading() { 128 void ExtensionOptionsGuest::GuestViewDidStopLoading() {
129 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 129 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
130 DispatchEventToView(new GuestViewEvent( 130 DispatchEventToView(make_scoped_ptr(new GuestViewEvent(
131 extension_options_internal::OnLoad::kEventName, std::move(args))); 131 extension_options_internal::OnLoad::kEventName, std::move(args))));
132 } 132 }
133 133
134 const char* ExtensionOptionsGuest::GetAPINamespace() const { 134 const char* ExtensionOptionsGuest::GetAPINamespace() const {
135 return extensionoptions::kAPINamespace; 135 return extensionoptions::kAPINamespace;
136 } 136 }
137 137
138 int ExtensionOptionsGuest::GetTaskPrefix() const { 138 int ExtensionOptionsGuest::GetTaskPrefix() const {
139 return IDS_EXTENSION_TASK_MANAGER_EXTENSIONOPTIONS_TAG_PREFIX; 139 return IDS_EXTENSION_TASK_MANAGER_EXTENSIONOPTIONS_TAG_PREFIX;
140 } 140 }
141 141
142 bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const { 142 bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const {
143 return true; 143 return true;
144 } 144 }
145 145
146 void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) { 146 void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) {
147 extension_options_internal::PreferredSizeChangedOptions options; 147 extension_options_internal::PreferredSizeChangedOptions options;
148 // Convert the size from physical pixels to logical pixels. 148 // Convert the size from physical pixels to logical pixels.
149 options.width = PhysicalPixelsToLogicalPixels(pref_size.width()); 149 options.width = PhysicalPixelsToLogicalPixels(pref_size.width());
150 options.height = PhysicalPixelsToLogicalPixels(pref_size.height()); 150 options.height = PhysicalPixelsToLogicalPixels(pref_size.height());
151 DispatchEventToView(new GuestViewEvent( 151 DispatchEventToView(make_scoped_ptr(new GuestViewEvent(
152 extension_options_internal::OnPreferredSizeChanged::kEventName, 152 extension_options_internal::OnPreferredSizeChanged::kEventName,
153 options.ToValue())); 153 options.ToValue())));
154 } 154 }
155 155
156 bool ExtensionOptionsGuest::ShouldHandleFindRequestsForEmbedder() const { 156 bool ExtensionOptionsGuest::ShouldHandleFindRequestsForEmbedder() const {
157 return true; 157 return true;
158 } 158 }
159 159
160 WebContents* ExtensionOptionsGuest::OpenURLFromTab( 160 WebContents* ExtensionOptionsGuest::OpenURLFromTab(
161 WebContents* source, 161 WebContents* source,
162 const content::OpenURLParams& params) { 162 const content::OpenURLParams& params) {
163 if (!extension_options_guest_delegate_) 163 if (!extension_options_guest_delegate_)
164 return nullptr; 164 return nullptr;
165 165
166 // Don't allow external URLs with the CURRENT_TAB disposition be opened in 166 // Don't allow external URLs with the CURRENT_TAB disposition be opened in
167 // this guest view, change the disposition to NEW_FOREGROUND_TAB. 167 // this guest view, change the disposition to NEW_FOREGROUND_TAB.
168 if ((!params.url.SchemeIs(extensions::kExtensionScheme) || 168 if ((!params.url.SchemeIs(extensions::kExtensionScheme) ||
169 params.url.host() != options_page_.host()) && 169 params.url.host() != options_page_.host()) &&
170 params.disposition == CURRENT_TAB) { 170 params.disposition == CURRENT_TAB) {
171 return extension_options_guest_delegate_->OpenURLInNewTab( 171 return extension_options_guest_delegate_->OpenURLInNewTab(
172 content::OpenURLParams(params.url, 172 content::OpenURLParams(params.url,
173 params.referrer, 173 params.referrer,
174 params.frame_tree_node_id, 174 params.frame_tree_node_id,
175 NEW_FOREGROUND_TAB, 175 NEW_FOREGROUND_TAB,
176 params.transition, 176 params.transition,
177 params.is_renderer_initiated)); 177 params.is_renderer_initiated));
178 } 178 }
179 return extension_options_guest_delegate_->OpenURLInNewTab(params); 179 return extension_options_guest_delegate_->OpenURLInNewTab(params);
180 } 180 }
181 181
182 void ExtensionOptionsGuest::CloseContents(WebContents* source) { 182 void ExtensionOptionsGuest::CloseContents(WebContents* source) {
183 DispatchEventToView( 183 DispatchEventToView(make_scoped_ptr(
184 new GuestViewEvent(extension_options_internal::OnClose::kEventName, 184 new GuestViewEvent(extension_options_internal::OnClose::kEventName,
185 make_scoped_ptr(new base::DictionaryValue()))); 185 make_scoped_ptr(new base::DictionaryValue()))));
186 } 186 }
187 187
188 bool ExtensionOptionsGuest::HandleContextMenu( 188 bool ExtensionOptionsGuest::HandleContextMenu(
189 const content::ContextMenuParams& params) { 189 const content::ContextMenuParams& params) {
190 if (!extension_options_guest_delegate_) 190 if (!extension_options_guest_delegate_)
191 return false; 191 return false;
192 192
193 return extension_options_guest_delegate_->HandleContextMenu(params); 193 return extension_options_guest_delegate_->HandleContextMenu(params);
194 } 194 }
195 195
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 SetGuestZoomLevelToMatchEmbedder(); 232 SetGuestZoomLevelToMatchEmbedder();
233 233
234 if (params.url.GetOrigin() != options_page_.GetOrigin()) { 234 if (params.url.GetOrigin() != options_page_.GetOrigin()) {
235 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(), 235 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(),
236 bad_message::EOG_BAD_ORIGIN); 236 bad_message::EOG_BAD_ORIGIN);
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 } // namespace extensions 241 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698