diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 02:06:01 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 02:06:01 +0000 |
commit | d5b2197037aac358c1ac7c747e2761e1562a584b (patch) | |
tree | 8e9f448966eb4215d77a65da0865503530498761 | |
parent | af2f56c8ee88d09483ef83792f9b9a31f4f08f79 (diff) | |
download | chromium_src-d5b2197037aac358c1ac7c747e2761e1562a584b.zip chromium_src-d5b2197037aac358c1ac7c747e2761e1562a584b.tar.gz chromium_src-d5b2197037aac358c1ac7c747e2761e1562a584b.tar.bz2 |
Revert 147594 - NaCl: Remove two uses of '#include "nacl/nacl_log.h"'
"git cl dcommit" went crazy and appears to have reverted the 3
previous commits at the same time as committing my change. (This
might be due to race conditions with running "git fetch"
concurrently.)
TBR=mseaborn@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10815024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147601 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 77 insertions, 42 deletions
@@ -78,6 +78,9 @@ 'chrome_frame': { 'filepath': 'chrome_frame/', }, + 'chrome_views': { + 'filepath': 'chrome/browser/ui/views', + }, 'chromedriver': { 'filepath': 'chrome/test/webdriver|third_party/webdriver' }, @@ -425,6 +428,7 @@ 'bubble': ['alicet@chromium.org', 'msw+watch@chromium.org'], 'chrome_frame': ['amit@chromium.org', 'grt+watch@chromium.org', 'robertshield@chromium.org'], + 'chrome_views': ['tfarina@chromium.org'], 'chromedriver': ['kkania@chromium.org'], 'chromeos' : ['oshima+watch@chromium.org', 'stevenjb+watch@chromium.org'], diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 2dcee1a..deb355f 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -1152,7 +1152,7 @@ void TestingAutomationProvider::GetDownloadDirectory( DownloadManager* dlm = BrowserContext::GetDownloadManager(tab->GetBrowserContext()); *download_directory = - DownloadPrefs::FromDownloadManager(dlm)->download_path(); + DownloadPrefs::FromDownloadManager(dlm)->DownloadPath(); } } diff --git a/chrome/browser/debugger/devtools_file_helper.cc b/chrome/browser/debugger/devtools_file_helper.cc index b3ea82e..188c8c8 100644 --- a/chrome/browser/debugger/devtools_file_helper.cc +++ b/chrome/browser/debugger/devtools_file_helper.cc @@ -4,6 +4,8 @@ #include "chrome/browser/debugger/devtools_file_helper.h" +#include <vector> + #include "base/bind.h" #include "base/callback.h" #include "base/file_util.h" @@ -18,8 +20,12 @@ #include "chrome/browser/ui/chrome_select_file_policy.h" #include "chrome/browser/ui/select_file_dialog.h" #include "chrome/common/pref_names.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/download_manager.h" +using content::BrowserContext; using content::BrowserThread; +using content::DownloadManager; namespace { @@ -147,8 +153,9 @@ void DevToolsFileHelper::Save(const std::string& url, initial_path = g_last_save_path.Pointer()->DirName().AppendASCII( suggested_file_name); } else { - DownloadPrefs prefs(profile_->GetPrefs()); - initial_path = prefs.download_path().AppendASCII(suggested_file_name); + FilePath download_path = DownloadPrefs::FromDownloadManager( + BrowserContext::GetDownloadManager(profile_))->DownloadPath(); + initial_path = download_path.AppendASCII(suggested_file_name); } } diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 87d4aa8..cffda03 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -106,7 +106,7 @@ SafeBrowsingState::~SafeBrowsingState() {} ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile) : profile_(profile), next_download_id_(0), - download_prefs_(new DownloadPrefs(profile->GetPrefs())) { + download_prefs_(new DownloadPrefs(profile)) { } ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() { @@ -660,7 +660,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( if (should_prompt && !download_manager_->LastDownloadPath().empty()) target_directory = download_manager_->LastDownloadPath(); else - target_directory = download_prefs_->download_path(); + target_directory = download_prefs_->DownloadPath(); suggested_path = target_directory.Append(generated_name); } else { DCHECK(!should_prompt); @@ -704,7 +704,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( this, download->GetId(), should_prompt, is_forced_path, danger_type)); #else GetReservedPath( - *download, suggested_path, download_prefs_->download_path(), + *download, suggested_path, download_prefs_->DownloadPath(), !is_forced_path, base::Bind(&ChromeDownloadManagerDelegate::OnPathReservationAvailable, this, download->GetId(), should_prompt, danger_type)); @@ -725,7 +725,7 @@ void ChromeDownloadManagerDelegate::SubstituteGDataDownloadPathCallback( return; GetReservedPath( - *download, suggested_path, download_prefs_->download_path(), + *download, suggested_path, download_prefs_->DownloadPath(), !is_forced_path, base::Bind(&ChromeDownloadManagerDelegate::OnPathReservationAvailable, this, download->GetId(), should_prompt, danger_type)); diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 4585d77..4b21c37 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -353,7 +353,7 @@ class DownloadTest : public InProcessBrowserTest { } FilePath GetDownloadDirectory(Browser* browser) { - return GetDownloadPrefs(browser)->download_path(); + return GetDownloadPrefs(browser)->DownloadPath(); } // Create a DownloadTestObserverTerminal that will wait for the diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index bc8a396..e5590b6 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc @@ -22,12 +22,14 @@ #include "chrome/browser/download/download_util.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/save_page_type.h" #if defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/gdata/gdata_system_service.h" #include "chrome/browser/chromeos/gdata/gdata_util.h" #endif @@ -35,7 +37,8 @@ using content::BrowserContext; using content::BrowserThread; using content::DownloadManager; -DownloadPrefs::DownloadPrefs(PrefService* prefs) : prefs_(prefs) { +DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) { + PrefService* prefs = profile->GetPrefs(); prompt_for_download_.Init(prefs::kPromptForDownload, prefs, NULL); download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL); save_file_type_.Init(prefs::kSaveFileType, prefs, NULL); @@ -122,6 +125,18 @@ DownloadPrefs* DownloadPrefs::FromBrowserContext( return FromDownloadManager(BrowserContext::GetDownloadManager(context)); } +FilePath DownloadPrefs::DownloadPath() const { +#if defined(OS_CHROMEOS) + // If the download path is under /drive, and GDataSystemService isn't + // available (which it isn't for incognito mode, for instance), use the + // default download directory (/Downloads). + if (gdata::util::IsUnderGDataMountPoint(*download_path_) && + !gdata::GDataSystemServiceFactory::GetForProfile(profile_)) + return download_util::GetDefaultDownloadDirectory(); +#endif + return *download_path_; +} + bool DownloadPrefs::PromptForDownload() const { // If the DownloadDirectory policy is set, then |prompt_for_download_| should // always be false. @@ -184,7 +199,7 @@ void DownloadPrefs::SaveAutoOpenState() { if (!extensions.empty()) extensions.erase(extensions.size() - 1); - prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions); + profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); } bool DownloadPrefs::AutoOpenCompareFunctor::operator()( diff --git a/chrome/browser/download/download_prefs.h b/chrome/browser/download/download_prefs.h index ab95eaf..86fd106 100644 --- a/chrome/browser/download/download_prefs.h +++ b/chrome/browser/download/download_prefs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,7 @@ #include "base/file_path.h" #include "chrome/browser/prefs/pref_member.h" -class PrefService; +class Profile; namespace content { class BrowserContext; @@ -20,7 +20,7 @@ class DownloadManager; // Stores all download-related preferences. class DownloadPrefs { public: - explicit DownloadPrefs(PrefService* prefs); + explicit DownloadPrefs(Profile* profile); ~DownloadPrefs(); static void RegisterUserPrefs(PrefService* prefs); @@ -32,7 +32,7 @@ class DownloadPrefs { static DownloadPrefs* FromBrowserContext( content::BrowserContext* browser_context); - FilePath download_path() const { return *download_path_; } + FilePath DownloadPath() const; int save_file_type() const { return *save_file_type_; } // Returns true if the prompt_for_download preference has been set and the @@ -62,7 +62,7 @@ class DownloadPrefs { private: void SaveAutoOpenState(); - PrefService* prefs_; + Profile* profile_; BooleanPrefMember prompt_for_download_; FilePathPrefMember download_path_; diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index 66e2843..0d4a106 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc @@ -352,7 +352,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, CleanFilenameFromPageTitle) { const FilePath file_name(FILE_PATH_LITERAL("c.htm")); FilePath download_dir = DownloadPrefs::FromDownloadManager(GetDownloadManager())-> - download_path(); + DownloadPath(); FilePath full_file_name = download_dir.AppendASCII(std::string("test.exe") + kAppendedExtension); FilePath dir = download_dir.AppendASCII("test.exe_files"); @@ -395,7 +395,7 @@ IN_PROC_BROWSER_TEST_F(SavePageAsMHTMLBrowserTest, SavePageAsMHTML) { static const int64 kFileSizeMin = 2758; GURL url = NavigateToMockURL("b"); FilePath download_dir = DownloadPrefs::FromDownloadManager( - GetDownloadManager())->download_path(); + GetDownloadManager())->DownloadPath(); FilePath full_file_name = download_dir.AppendASCII(std::string( "Test page for saving page feature.mhtml")); #if defined(OS_CHROMEOS) diff --git a/chrome/browser/extensions/api/serial/serial_api.cc b/chrome/browser/extensions/api/serial/serial_api.cc index 57e33b0..80a2646 100644 --- a/chrome/browser/extensions/api/serial/serial_api.cc +++ b/chrome/browser/extensions/api/serial/serial_api.cc @@ -236,8 +236,8 @@ bool SerialWriteFunction::Prepare() { params_ = api::experimental_serial::Write::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(params_.get()); - io_buffer_size_ = params_->data->GetSize(); - io_buffer_ = new net::WrappedIOBuffer(params_->data->GetBuffer()); + io_buffer_size_ = params_->data.size(); + io_buffer_ = new net::WrappedIOBuffer(params_->data.data()); return true; } diff --git a/chrome/browser/extensions/api/usb/usb_device_resource.cc b/chrome/browser/extensions/api/usb/usb_device_resource.cc index 8d8525c..da8efdf 100644 --- a/chrome/browser/extensions/api/usb/usb_device_resource.cc +++ b/chrome/browser/extensions/api/usb/usb_device_resource.cc @@ -101,7 +101,7 @@ static bool GetTransferSize(const T& input, size_t* output) { } } else if (input.direction == kDirectionOut) { if (input.data.get()) { - *output = input.data->GetSize(); + *output = input.data->size(); return true; } } @@ -120,7 +120,7 @@ static scoped_refptr<net::IOBuffer> CreateBufferForTransfer(const T& input) { return buffer; } - memcpy(buffer->data(), input.data->GetBuffer(), size); + memcpy(buffer->data(), input.data->data(), size); return buffer; } diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index faf29c9..4bf576a 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -206,7 +206,7 @@ void WebstoreInstaller::Start() { } FilePath download_path = DownloadPrefs::FromDownloadManager( - BrowserContext::GetDownloadManager(profile_))->download_path(); + BrowserContext::GetDownloadManager(profile_))->DownloadPath(); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(&GetDownloadFilePath, download_path, id_, diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc index 12e6bd2..3e9d655 100644 --- a/chrome/browser/ui/ash/screenshot_taker.cc +++ b/chrome/browser/ui/ash/screenshot_taker.cc @@ -153,7 +153,7 @@ void ScreenshotTaker::HandleTakePartialScreenshot( if (is_logged_in) { DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext()); - screenshot_directory = download_prefs->download_path(); + screenshot_directory = download_prefs->DownloadPath(); } else { if (!file_util::GetTempDir(&screenshot_directory)) { LOG(ERROR) << "Failed to find temporary directory."; diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc index d10d8e6..514ae7a 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler.cc +++ b/chrome/browser/ui/webui/downloads_dom_handler.cc @@ -341,7 +341,7 @@ void DownloadsDOMHandler::HandleClearAll(const ListValue* args) { void DownloadsDOMHandler::HandleOpenDownloadsFolder(const ListValue* args) { CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); platform_util::OpenItem( - DownloadPrefs::FromDownloadManager(download_manager_)->download_path()); + DownloadPrefs::FromDownloadManager(download_manager_)->DownloadPath()); } // DownloadsDOMHandler, private: ---------------------------------------------- diff --git a/chrome/browser/ui/webui/feedback_ui.cc b/chrome/browser/ui/webui/feedback_ui.cc index 96ea099..83bbe87 100644 --- a/chrome/browser/ui/webui/feedback_ui.cc +++ b/chrome/browser/ui/webui/feedback_ui.cc @@ -98,7 +98,7 @@ void GetSavedScreenshots(std::vector<std::string>* saved_screenshots) { DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext()); FeedbackUI::GetMostRecentScreenshots( - download_prefs->download_path(), + download_prefs->DownloadPath(), saved_screenshots, kMaxSavedScreenshots); } diff --git a/chrome/browser/ui/webui/screenshot_source.cc b/chrome/browser/ui/webui/screenshot_source.cc index 9a7798f..15d0d57 100644 --- a/chrome/browser/ui/webui/screenshot_source.cc +++ b/chrome/browser/ui/webui/screenshot_source.cc @@ -104,7 +104,7 @@ void ScreenshotSource::SendSavedScreenshot(const std::string& screenshot_path, int64 file_size = 0; DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext()); - FilePath file = download_prefs->download_path().Append(decoded_filename); + FilePath file = download_prefs->DownloadPath().Append(decoded_filename); if (!file_util::GetFileSize(file, &file_size)) { CacheAndSendScreenshot(screenshot_path, request_id, read_bytes); return; diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_audio/ppapi_ppb_audio.cc b/ppapi/native_client/tests/ppapi_browser/ppb_audio/ppapi_ppb_audio.cc index 14dd93e..1dfc314 100644 --- a/ppapi/native_client/tests/ppapi_browser/ppb_audio/ppapi_ppb_audio.cc +++ b/ppapi/native_client/tests/ppapi_browser/ppb_audio/ppapi_ppb_audio.cc @@ -3,6 +3,8 @@ // found in the LICENSE file. // +#include <nacl/nacl_log.h> + #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -14,6 +16,7 @@ #include "native_client/src/include/nacl_macros.h" #include "native_client/src/include/nacl/nacl_inttypes.h" +#include "native_client/src/shared/platform/nacl_check.h" #include "native_client/src/shared/ppapi_proxy/utility.h" #include "native_client/tests/ppapi_test_lib/get_browser_interface.h" #include "native_client/tests/ppapi_test_lib/test_interface.h" diff --git a/ppapi/native_client/tests/ppapi_example_audio/audio.cc b/ppapi/native_client/tests/ppapi_example_audio/audio.cc index 4574b30..e2c6a32 100644 --- a/ppapi/native_client/tests/ppapi_example_audio/audio.cc +++ b/ppapi/native_client/tests/ppapi_example_audio/audio.cc @@ -3,6 +3,8 @@ // found in the LICENSE file. // +#include <nacl/nacl_log.h> + #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -12,7 +14,6 @@ #include <limits> #include <string> #include "native_client/src/include/nacl/nacl_inttypes.h" -#include "native_client/src/shared/platform/nacl_log.h" #include "native_client/src/shared/ppapi_proxy/utility.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_errors.h" diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py index d21e160..770ae48 100644 --- a/tools/json_schema_compiler/cc_generator.py +++ b/tools/json_schema_compiler/cc_generator.py @@ -355,7 +355,12 @@ class CCGenerator(object): elif prop.type_ == PropertyType.ENUM: return 'CreateEnumValue(%s).release()' % var elif prop.type_ == PropertyType.BINARY: - return '%s->DeepCopy()' % var + if prop.optional: + vardot = var + '->' + else: + vardot = var + '.' + return ('base::BinaryValue::CreateWithCopiedBuffer(%sdata(), %ssize())' % + (vardot, vardot)) elif self._IsArrayOrArrayRef(prop): return '%s.release()' % self._util_cc_helper.CreateValueFromArray( self._cpp_type_generator.GetReferencedProperty(prop), var, @@ -542,15 +547,20 @@ class CCGenerator(object): c.Append('%(dst)s->%(name)s = enum_temp;') c.Eblock('}') elif prop.type_ == PropertyType.BINARY: - # This is the same if the property is optional or not. We need a pointer - # to the base::BinaryValue to be able to populate it, so a scoped_ptr is - # used whether it is optional or required. (c.Append('if (!%(value_var)s->IsType(%(value_type)s))') .Append(' return %(failure_value)s;') - .Append('%(dst)s->%(name)s.reset(') - .Append(' static_cast<base::BinaryValue*>(%(value_var)s)' - '->DeepCopy());') - ) + .Append('base::BinaryValue* binary_value =') + .Append(' static_cast<base::BinaryValue*>(%(value_var)s);') + ) + if prop.optional: + (c.Append('%(dst)s->%(name)s.reset(') + .Append(' new std::string(binary_value->GetBuffer(),') + .Append(' binary_value->GetSize()));') + ) + else: + (c.Append('%(dst)s->%(name)s.assign(binary_value->GetBuffer(),') + .Append(' binary_value->GetSize());') + ) else: raise NotImplementedError(prop.type_) c.Eblock('}') diff --git a/tools/json_schema_compiler/cpp_type_generator.py b/tools/json_schema_compiler/cpp_type_generator.py index 5b54bae..f398c75 100644 --- a/tools/json_schema_compiler/cpp_type_generator.py +++ b/tools/json_schema_compiler/cpp_type_generator.py @@ -127,7 +127,6 @@ class CppTypeGenerator(object): optional. """ cpp_type = None - force_wrapping = False if prop.type_ == PropertyType.REF: dependency_namespace = self._ResolveTypeNamespace(prop.ref_type) if not dependency_namespace: @@ -165,17 +164,13 @@ class CppTypeGenerator(object): cpp_type = cpp_type % self.GetType( prop.item_type, pad_for_generics=True) elif prop.type_ == PropertyType.BINARY: - # Since base::BinaryValue's are immutable, we wrap them in a scoped_ptr to - # allow them to be modified after the fact. - force_wrapping = True - cpp_type = 'base::BinaryValue' + cpp_type = 'std::string' else: raise NotImplementedError(prop.type_) # Enums aren't wrapped because C++ won't allow it. Optional enums have a # NONE value generated instead. - if force_wrapping or (wrap_optional and prop.optional and prop.type_ != - PropertyType.ENUM): + if wrap_optional and prop.optional and prop.type_ != PropertyType.ENUM: cpp_type = 'scoped_ptr<%s> ' % cpp_type if pad_for_generics: return cpp_type |