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

Side by Side Diff: content/browser/web_contents/web_contents_impl.h

Issue 1685343004: Don't call WebContents::DownloadImage() callback if the WebContents were deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 (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 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 void AddDestructionObserver(WebContentsImpl* web_contents); 811 void AddDestructionObserver(WebContentsImpl* web_contents);
812 812
813 // Deletes and removes from the map a destruction observer 813 // Deletes and removes from the map a destruction observer
814 // watching |web_contents|. No-op if there is no such observer. 814 // watching |web_contents|. No-op if there is no such observer.
815 void RemoveDestructionObserver(WebContentsImpl* web_contents); 815 void RemoveDestructionObserver(WebContentsImpl* web_contents);
816 816
817 // Traverses all the RenderFrameHosts in the FrameTree and creates a set 817 // Traverses all the RenderFrameHosts in the FrameTree and creates a set
818 // all the unique RenderWidgetHostViews. 818 // all the unique RenderWidgetHostViews.
819 std::set<RenderWidgetHostView*> GetRenderWidgetHostViewsInTree(); 819 std::set<RenderWidgetHostView*> GetRenderWidgetHostViewsInTree();
820 820
821 // Called with the result of a DownloadImage() request.
822 void OnDidDownloadImage(const ImageDownloadCallback& callback,
823 int id,
824 const GURL& image_url,
825 image_downloader::DownloadResultPtr result);
826
821 // Callback function when showing JavaScript dialogs. Takes in a routing ID 827 // Callback function when showing JavaScript dialogs. Takes in a routing ID
822 // pair to identify the RenderFrameHost that opened the dialog, because it's 828 // pair to identify the RenderFrameHost that opened the dialog, because it's
823 // possible for the RenderFrameHost to be deleted by the time this is called. 829 // possible for the RenderFrameHost to be deleted by the time this is called.
824 void OnDialogClosed(int render_process_id, 830 void OnDialogClosed(int render_process_id,
825 int render_frame_id, 831 int render_frame_id,
826 IPC::Message* reply_msg, 832 IPC::Message* reply_msg,
827 bool dialog_was_suppressed, 833 bool dialog_was_suppressed,
828 bool success, 834 bool success,
829 const base::string16& user_input); 835 const base::string16& user_input);
830 836
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 1306
1301 // Manages media players, CDMs, and power save blockers for media. 1307 // Manages media players, CDMs, and power save blockers for media.
1302 scoped_ptr<MediaWebContentsObserver> media_web_contents_observer_; 1308 scoped_ptr<MediaWebContentsObserver> media_web_contents_observer_;
1303 1309
1304 scoped_ptr<RenderWidgetHostInputEventRouter> rwh_input_event_router_; 1310 scoped_ptr<RenderWidgetHostInputEventRouter> rwh_input_event_router_;
1305 1311
1306 PageImportanceSignals page_importance_signals_; 1312 PageImportanceSignals page_importance_signals_;
1307 1313
1308 bool page_scale_factor_is_one_; 1314 bool page_scale_factor_is_one_;
1309 1315
1316 base::WeakPtrFactory<WebContentsImpl> download_image_weak_factory_;
jam 2016/02/12 23:31:42 since this is never reset, just make this be weak_
1310 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_; 1317 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
1311 1318
1312 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); 1319 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
1313 }; 1320 };
1314 1321
1315 // Dangerous methods which should never be made part of the public API, so we 1322 // Dangerous methods which should never be made part of the public API, so we
1316 // grant their use only to an explicit friend list (c++ attorney/client idiom). 1323 // grant their use only to an explicit friend list (c++ attorney/client idiom).
1317 class CONTENT_EXPORT WebContentsImpl::FriendZone { 1324 class CONTENT_EXPORT WebContentsImpl::FriendZone {
1318 private: 1325 private:
1319 friend class TestNavigationObserver; 1326 friend class TestNavigationObserver;
1320 friend class WebContentsAddedObserver; 1327 friend class WebContentsAddedObserver;
1321 friend class ContentBrowserSanityChecker; 1328 friend class ContentBrowserSanityChecker;
1322 1329
1323 FriendZone(); // Not instantiable. 1330 FriendZone(); // Not instantiable.
1324 1331
1325 // Adds/removes a callback called on creation of each new WebContents. 1332 // Adds/removes a callback called on creation of each new WebContents.
1326 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); 1333 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1327 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); 1334 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1328 1335
1329 DISALLOW_COPY_AND_ASSIGN(FriendZone); 1336 DISALLOW_COPY_AND_ASSIGN(FriendZone);
1330 }; 1337 };
1331 1338
1332 } // namespace content 1339 } // namespace content
1333 1340
1334 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1341 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | content/browser/web_contents/web_contents_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698