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

Side by Side Diff: chrome/utility/importer/ie_importer_win.cc

Issue 721783003: Remove implicit conversions from scoped_refptr to T* in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "chrome/utility/importer/ie_importer_win.h" 5 #include "chrome/utility/importer/ie_importer_win.h"
6 6
7 #include <ole2.h> 7 #include <ole2.h>
8 #include <intshcut.h> 8 #include <intshcut.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #include <urlhist.h> 10 #include <urlhist.h>
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // representing it. 269 // representing it.
270 bool LoadInternetShortcut( 270 bool LoadInternetShortcut(
271 const base::string16& file, 271 const base::string16& file,
272 base::win::ScopedComPtr<IUniformResourceLocator>* shortcut) { 272 base::win::ScopedComPtr<IUniformResourceLocator>* shortcut) {
273 base::win::ScopedComPtr<IUniformResourceLocator> url_locator; 273 base::win::ScopedComPtr<IUniformResourceLocator> url_locator;
274 if (FAILED(url_locator.CreateInstance(CLSID_InternetShortcut, NULL, 274 if (FAILED(url_locator.CreateInstance(CLSID_InternetShortcut, NULL,
275 CLSCTX_INPROC_SERVER))) 275 CLSCTX_INPROC_SERVER)))
276 return false; 276 return false;
277 277
278 base::win::ScopedComPtr<IPersistFile> persist_file; 278 base::win::ScopedComPtr<IPersistFile> persist_file;
279 if (FAILED(persist_file.QueryFrom(url_locator))) 279 if (FAILED(persist_file.QueryFrom(url_locator.get())))
280 return false; 280 return false;
281 281
282 // Loads the Internet Shortcut from persistent storage. 282 // Loads the Internet Shortcut from persistent storage.
283 if (FAILED(persist_file->Load(file.c_str(), STGM_READ))) 283 if (FAILED(persist_file->Load(file.c_str(), STGM_READ)))
284 return false; 284 return false;
285 285
286 std::swap(url_locator, *shortcut); 286 std::swap(url_locator, *shortcut);
287 return true; 287 return true;
288 } 288 }
289 289
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 for (std::vector<base::FilePath::StringType>::iterator it = file_list.begin(); 814 for (std::vector<base::FilePath::StringType>::iterator it = file_list.begin();
815 it != file_list.end(); ++it) { 815 it != file_list.end(); ++it) {
816 base::FilePath shortcut(*it); 816 base::FilePath shortcut(*it);
817 if (!LowerCaseEqualsASCII(shortcut.Extension(), ".url")) 817 if (!LowerCaseEqualsASCII(shortcut.Extension(), ".url"))
818 continue; 818 continue;
819 819
820 // Skip the bookmark with invalid URL. 820 // Skip the bookmark with invalid URL.
821 base::win::ScopedComPtr<IUniformResourceLocator> url_locator; 821 base::win::ScopedComPtr<IUniformResourceLocator> url_locator;
822 if (!LoadInternetShortcut(*it, &url_locator)) 822 if (!LoadInternetShortcut(*it, &url_locator))
823 continue; 823 continue;
824 GURL url = ReadURLFromInternetShortcut(url_locator); 824 GURL url = ReadURLFromInternetShortcut(url_locator.get());
825 if (!url.is_valid()) 825 if (!url.is_valid())
826 continue; 826 continue;
827 // Skip default bookmarks. go.microsoft.com redirects to 827 // Skip default bookmarks. go.microsoft.com redirects to
828 // search.microsoft.com, and http://go.microsoft.com/fwlink/?LinkId=XXX, 828 // search.microsoft.com, and http://go.microsoft.com/fwlink/?LinkId=XXX,
829 // which URLs IE has as default, to some another sites. 829 // which URLs IE has as default, to some another sites.
830 // We expect that users will never themselves create bookmarks having this 830 // We expect that users will never themselves create bookmarks having this
831 // hostname. 831 // hostname.
832 if (url.host() == "go.microsoft.com") 832 if (url.host() == "go.microsoft.com")
833 continue; 833 continue;
834 // Read favicon. 834 // Read favicon.
835 UpdateFaviconMap(*it, url, url_locator, &favicon_map); 835 UpdateFaviconMap(*it, url, url_locator.get(), &favicon_map);
836 836
837 // Make the relative path from the Favorites folder, without the basename. 837 // Make the relative path from the Favorites folder, without the basename.
838 // ex. Suppose that the Favorites folder is C:\Users\Foo\Favorites. 838 // ex. Suppose that the Favorites folder is C:\Users\Foo\Favorites.
839 // C:\Users\Foo\Favorites\Foo.url -> "" 839 // C:\Users\Foo\Favorites\Foo.url -> ""
840 // C:\Users\Foo\Favorites\Links\Bar\Baz.url -> "Links\Bar" 840 // C:\Users\Foo\Favorites\Links\Bar\Baz.url -> "Links\Bar"
841 base::FilePath::StringType relative_string = 841 base::FilePath::StringType relative_string =
842 shortcut.DirName().value().substr(favorites_path_len); 842 shortcut.DirName().value().substr(favorites_path_len);
843 if (!relative_string.empty() && 843 if (!relative_string.empty() &&
844 base::FilePath::IsSeparator(relative_string[0])) 844 base::FilePath::IsSeparator(relative_string[0]))
845 relative_string = relative_string.substr(1); 845 relative_string = relative_string.substr(1);
(...skipping 28 matching lines...) Expand all
874 static int version = -1; 874 static int version = -1;
875 if (version < 0) { 875 if (version < 0) {
876 wchar_t buffer[128]; 876 wchar_t buffer[128];
877 DWORD buffer_length = sizeof(buffer); 877 DWORD buffer_length = sizeof(buffer);
878 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); 878 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ);
879 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); 879 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL);
880 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); 880 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0);
881 } 881 }
882 return version; 882 return version;
883 } 883 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698