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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 261013005: BrowserPlugin: Move CreateGuest to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_simplify_api
Patch Set: Created 6 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 const GURL& site_url = GetWebContents()->GetSiteInstance()->GetSiteURL(); 318 const GURL& site_url = GetWebContents()->GetSiteInstance()->GetSiteURL();
319 BrowserPluginHostMsg_Attach_Params attach_params; 319 BrowserPluginHostMsg_Attach_Params attach_params;
320 attach_params.storage_partition_id = site_url.query(); 320 attach_params.storage_partition_id = site_url.query();
321 attach_params.persist_storage = 321 attach_params.persist_storage =
322 site_url.path().find("persist") != std::string::npos; 322 site_url.path().find("persist") != std::string::npos;
323 323
324 // The new guest gets a copy of this guest's extra params so that the content 324 // The new guest gets a copy of this guest's extra params so that the content
325 // embedder exposes the same API for this guest as its opener. 325 // embedder exposes the same API for this guest as its opener.
326 scoped_ptr<base::DictionaryValue> extra_params( 326 scoped_ptr<base::DictionaryValue> extra_params(
327 extra_attach_params_->DeepCopy()); 327 extra_attach_params_->DeepCopy());
328 StorageInfo storage_info;
329 storage_info.partition_id = attach_params.storage_partition_id;
330 storage_info.persist = attach_params.persist_storage;
328 BrowserPluginGuest* new_guest = 331 BrowserPluginGuest* new_guest =
329 guest_manager->CreateGuest(GetWebContents()->GetSiteInstance(), 332 guest_manager->CreateGuest(GetWebContents()->GetSiteInstance(),
330 instance_id, 333 instance_id,
331 attach_params, 334 storage_info,
332 extra_params.Pass()); 335 extra_params.Pass());
333 if (new_guest->delegate_) 336 if (new_guest->delegate_)
334 new_guest->delegate_->SetOpener(GetWebContents()); 337 new_guest->delegate_->SetOpener(GetWebContents());
335 338
336 // Take ownership of |new_guest|. 339 // Take ownership of |new_guest|.
337 pending_new_windows_.insert( 340 pending_new_windows_.insert(
338 std::make_pair(new_guest, NewWindowInfo(params.url, std::string()))); 341 std::make_pair(new_guest, NewWindowInfo(params.url, std::string())));
339 342
340 // Request permission to show the new window. 343 // Request permission to show the new window.
341 RequestNewWindowPermission(params.disposition, gfx::Rect(), 344 RequestNewWindowPermission(params.disposition, gfx::Rect(),
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 const GURL& url) { 1553 const GURL& url) {
1551 if (!url.is_valid()) { 1554 if (!url.is_valid()) {
1552 callback.Run(false); 1555 callback.Run(false);
1553 return; 1556 return;
1554 } 1557 }
1555 1558
1556 delegate_->CanDownload(request_method, url, callback); 1559 delegate_->CanDownload(request_method, url, callback);
1557 } 1560 }
1558 1561
1559 } // namespace content 1562 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698