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

Side by Side Diff: chrome/browser/extensions/api/bookmarks/bookmarks_api.cc

Issue 12440034: Merge 184586 "Fix heap-use-after-free in BookmarksIOFunction::Sh..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" 5 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/i18n/file_util_icu.h" 9 #include "base/i18n/file_util_icu.h"
10 #include "base/i18n/time_formatting.h" 10 #include "base/i18n/time_formatting.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 908
909 // After getting the |default_path|, ask the UI to display the file dialog. 909 // After getting the |default_path|, ask the UI to display the file dialog.
910 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 910 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
911 base::Bind(&BookmarksIOFunction::ShowSelectFileDialog, this, 911 base::Bind(&BookmarksIOFunction::ShowSelectFileDialog, this,
912 type, default_path)); 912 type, default_path));
913 } 913 }
914 914
915 void BookmarksIOFunction::ShowSelectFileDialog( 915 void BookmarksIOFunction::ShowSelectFileDialog(
916 ui::SelectFileDialog::Type type, 916 ui::SelectFileDialog::Type type,
917 const base::FilePath& default_path) { 917 const base::FilePath& default_path) {
918 if (!dispatcher())
919 return; // Extension was unloaded.
920
918 // Balanced in one of the three callbacks of SelectFileDialog: 921 // Balanced in one of the three callbacks of SelectFileDialog:
919 // either FileSelectionCanceled, MultiFilesSelected, or FileSelected 922 // either FileSelectionCanceled, MultiFilesSelected, or FileSelected
920 AddRef(); 923 AddRef();
921 924
922 WebContents* web_contents = dispatcher()->delegate()-> 925 WebContents* web_contents = dispatcher()->delegate()->
923 GetAssociatedWebContents(); 926 GetAssociatedWebContents();
924 927
925 select_file_dialog_ = ui::SelectFileDialog::Create( 928 select_file_dialog_ = ui::SelectFileDialog::Create(
926 this, new ChromeSelectFilePolicy(web_contents)); 929 this, new ChromeSelectFilePolicy(web_contents));
927 ui::SelectFileDialog::FileTypeInfo file_type_info; 930 ui::SelectFileDialog::FileTypeInfo file_type_info;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 #if !defined(OS_ANDROID) 995 #if !defined(OS_ANDROID)
993 // Android does not have support for the standard exporter. 996 // Android does not have support for the standard exporter.
994 // TODO(jgreenwald): remove ifdef once extensions are no longer built on 997 // TODO(jgreenwald): remove ifdef once extensions are no longer built on
995 // Android. 998 // Android.
996 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); 999 bookmark_html_writer::WriteBookmarks(profile(), path, NULL);
997 #endif 1000 #endif
998 Release(); // Balanced in BookmarksIOFunction::SelectFile() 1001 Release(); // Balanced in BookmarksIOFunction::SelectFile()
999 } 1002 }
1000 1003
1001 } // namespace extensions 1004 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698