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

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

Issue 23965004: Revert 222090 "<webview>: Cleanup WebRequest event listeners whe..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 guest->embedder_web_contents()->GetRenderViewHost()), 312 guest->embedder_web_contents()->GetRenderViewHost()),
313 browser_plugin_guest_(guest) { 313 browser_plugin_guest_(guest) {
314 } 314 }
315 315
316 virtual ~EmbedderRenderViewHostObserver() { 316 virtual ~EmbedderRenderViewHostObserver() {
317 } 317 }
318 318
319 // RenderViewHostObserver: 319 // RenderViewHostObserver:
320 virtual void RenderViewHostDestroyed( 320 virtual void RenderViewHostDestroyed(
321 RenderViewHost* render_view_host) OVERRIDE { 321 RenderViewHost* render_view_host) OVERRIDE {
322 browser_plugin_guest_->EmbedderDestroyed(); 322 browser_plugin_guest_->embedder_web_contents_ = NULL;
323 browser_plugin_guest_->Destroy();
323 } 324 }
324 325
325 private: 326 private:
326 BrowserPluginGuest* browser_plugin_guest_; 327 BrowserPluginGuest* browser_plugin_guest_;
327 328
328 DISALLOW_COPY_AND_ASSIGN(EmbedderRenderViewHostObserver); 329 DISALLOW_COPY_AND_ASSIGN(EmbedderRenderViewHostObserver);
329 }; 330 };
330 331
331 BrowserPluginGuest::BrowserPluginGuest( 332 BrowserPluginGuest::BrowserPluginGuest(
332 int instance_id, 333 int instance_id,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 AsWeakPtr(), 417 AsWeakPtr(),
417 request_id); 418 request_id);
418 // If BrowserPluginGuestDelegate hasn't handled the permission then we simply 419 // If BrowserPluginGuestDelegate hasn't handled the permission then we simply
419 // reject it immediately. 420 // reject it immediately.
420 if (!delegate_->RequestPermission(permission_type, request_info, callback)) 421 if (!delegate_->RequestPermission(permission_type, request_info, callback))
421 callback.Run(false, ""); 422 callback.Run(false, "");
422 423
423 return request_id; 424 return request_id;
424 } 425 }
425 426
426 void BrowserPluginGuest::EmbedderDestroyed() {
427 embedder_web_contents_ = NULL;
428 if (delegate_)
429 delegate_->EmbedderDestroyed();
430 Destroy();
431 }
432
433 void BrowserPluginGuest::Destroy() { 427 void BrowserPluginGuest::Destroy() {
434 is_in_destruction_ = true; 428 is_in_destruction_ = true;
435 if (!attached() && opener()) 429 if (!attached() && opener())
436 opener()->pending_new_windows_.erase(this); 430 opener()->pending_new_windows_.erase(this);
437 DestroyUnattachedWindows(); 431 DestroyUnattachedWindows();
438 GetWebContents()->GetBrowserPluginGuestManager()->RemoveGuest(instance_id_); 432 GetWebContents()->GetBrowserPluginGuestManager()->RemoveGuest(instance_id_);
439 delete GetWebContents(); 433 delete GetWebContents();
440 } 434 }
441 435
442 bool BrowserPluginGuest::OnMessageReceivedFromEmbedder( 436 bool BrowserPluginGuest::OnMessageReceivedFromEmbedder(
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 request_info.Set(browser_plugin::kRequestMethod, 1687 request_info.Set(browser_plugin::kRequestMethod,
1694 base::Value::CreateStringValue(request_method)); 1688 base::Value::CreateStringValue(request_method));
1695 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); 1689 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url));
1696 1690
1697 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, 1691 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD,
1698 new DownloadRequest(callback), 1692 new DownloadRequest(callback),
1699 request_info); 1693 request_info);
1700 } 1694 }
1701 1695
1702 } // namespace content 1696 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698