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

Side by Side Diff: app/os_exchange_data_win.cc

Issue 113565: Create a new app_strings target that builds strings for the app_base and even... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « app/gfx/font_win.cc ('k') | app/resources/app_strings.grd » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "app/os_exchange_data.h" 5 #include "app/os_exchange_data.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/clipboard_util.h" 8 #include "base/clipboard_util.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/pickle.h" 11 #include "base/pickle.h"
12 #include "base/scoped_handle.h" 12 #include "base/scoped_handle.h"
13 #include "base/stl_util-inl.h" 13 #include "base/stl_util-inl.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 #include "grit/generated_resources.h" 16 #include "grit/app_strings.h"
17 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
18 18
19 // Creates a new STGMEDIUM object to hold the specified text. The caller 19 // Creates a new STGMEDIUM object to hold the specified text. The caller
20 // owns the resulting object. The "Bytes" version does not NULL terminate, the 20 // owns the resulting object. The "Bytes" version does not NULL terminate, the
21 // string version does. 21 // string version does.
22 static STGMEDIUM* GetStorageForBytes(const char* data, size_t bytes); 22 static STGMEDIUM* GetStorageForBytes(const char* data, size_t bytes);
23 static STGMEDIUM* GetStorageForWString(const std::wstring& data); 23 static STGMEDIUM* GetStorageForWString(const std::wstring& data);
24 static STGMEDIUM* GetStorageForString(const std::string& data); 24 static STGMEDIUM* GetStorageForString(const std::string& data);
25 // Creates the contents of an Internet Shortcut file for the given URL. 25 // Creates the contents of an Internet Shortcut file for the given URL.
26 static void GetInternetShortcutFileContents(const GURL& url, std::string* data); 26 static void GetInternetShortcutFileContents(const GURL& url, std::string* data);
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 661
662 static void CreateValidFileNameFromTitle(const GURL& url, 662 static void CreateValidFileNameFromTitle(const GURL& url,
663 const std::wstring& title, 663 const std::wstring& title,
664 std::wstring* validated) { 664 std::wstring* validated) {
665 if (title.empty()) { 665 if (title.empty()) {
666 if (url.is_valid()) { 666 if (url.is_valid()) {
667 *validated = net::GetSuggestedFilename( 667 *validated = net::GetSuggestedFilename(
668 url, std::string(), std::string(), std::wstring()); 668 url, std::string(), std::string(), std::wstring());
669 } else { 669 } else {
670 // Nothing else can be done, just use a default. 670 // Nothing else can be done, just use a default.
671 *validated = l10n_util::GetString(IDS_UNTITLED_SHORTCUT_FILE_NAME); 671 *validated = l10n_util::GetString(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME);
672 } 672 }
673 } else { 673 } else {
674 *validated = title; 674 *validated = title;
675 file_util::ReplaceIllegalCharacters(validated, '-'); 675 file_util::ReplaceIllegalCharacters(validated, '-');
676 } 676 }
677 static const wchar_t extension[] = L".url"; 677 static const wchar_t extension[] = L".url";
678 static const size_t max_length = MAX_PATH - arraysize(extension); 678 static const size_t max_length = MAX_PATH - arraysize(extension);
679 if (validated->size() > max_length) 679 if (validated->size() > max_length)
680 validated->erase(max_length); 680 validated->erase(max_length);
681 *validated += extension; 681 *validated += extension;
(...skipping 13 matching lines...) Expand all
695 descriptor->fgd[0].dwFlags = FD_LINKUI; 695 descriptor->fgd[0].dwFlags = FD_LINKUI;
696 696
697 GlobalUnlock(handle); 697 GlobalUnlock(handle);
698 698
699 STGMEDIUM* storage = new STGMEDIUM; 699 STGMEDIUM* storage = new STGMEDIUM;
700 storage->hGlobal = handle; 700 storage->hGlobal = handle;
701 storage->tymed = TYMED_HGLOBAL; 701 storage->tymed = TYMED_HGLOBAL;
702 storage->pUnkForRelease = NULL; 702 storage->pUnkForRelease = NULL;
703 return storage; 703 return storage;
704 } 704 }
OLDNEW
« no previous file with comments | « app/gfx/font_win.cc ('k') | app/resources/app_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698