Update to Chromium version 91.0.4472.0 (#870763)

This commit is contained in:
Marshall Greenblatt 2021-04-20 18:52:34 -04:00
parent b189c7b472
commit ae4f68f695
193 changed files with 1381 additions and 1897 deletions

View File

@ -125,7 +125,6 @@ if (is_mac) {
import("//build/config/mac/rules.gni")
import("//build/util/version.gni")
import("//media/cdm/library_cdm/cdm_paths.gni")
import("//build/config/mac/base_rules.gni")
# Template to compile .xib and .storyboard files.
#

View File

@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/90.0.4430.0'
'chromium_checkout': 'refs/tags/91.0.4472.0'
}

View File

@ -22,7 +22,6 @@
'include/base/cef_platform_thread.h',
'include/base/cef_ref_counted.h',
'include/base/cef_scoped_ptr.h',
'include/base/cef_string16.h',
'include/base/cef_template_util.h',
'include/base/cef_thread_checker.h',
'include/base/cef_trace_event.h',
@ -128,7 +127,6 @@
'libcef_dll/base/cef_lock_impl.cc',
'libcef_dll/base/cef_logging.cc',
'libcef_dll/base/cef_ref_counted.cc',
'libcef_dll/base/cef_string16.cc',
'libcef_dll/base/cef_thread_checker_impl.cc',
'libcef_dll/base/cef_weak_ptr.cc',
],

View File

@ -75,7 +75,6 @@ typedef unsigned short uint16;
#endif
// UTF-16 character type.
// This should be kept synchronized with base/strings/string16.h
#ifndef char16
#if defined(WCHAR_T_IS_UTF16)
typedef wchar_t char16;

View File

@ -1,223 +0,0 @@
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2013
// Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef CEF_INCLUDE_BASE_CEF_STRING16_H_
#define CEF_INCLUDE_BASE_CEF_STRING16_H_
#pragma once
#if defined(BASE_STRINGS_STRING16_H_)
// Do nothing if the Chromium header has already been included.
// This can happen in cases where Chromium code is used directly by the
// client application. When using Chromium code directly always include
// the Chromium header first to avoid type conflicts.
#elif defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/strings/string16.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
// updated to match.
// WHAT:
// A version of std::basic_string that provides 2-byte characters even when
// wchar_t is not implemented as a 2-byte type. You can access this class as
// string16. We also define char16, which string16 is based upon.
//
// WHY:
// On Windows, wchar_t is 2 bytes, and it can conveniently handle UTF-16/UCS-2
// data. Plenty of existing code operates on strings encoded as UTF-16.
//
// On many other platforms, sizeof(wchar_t) is 4 bytes by default. We can make
// it 2 bytes by using the GCC flag -fshort-wchar. But then std::wstring fails
// at run time, because it calls some functions (like wcslen) that come from
// the system's native C library -- which was built with a 4-byte wchar_t!
// It's wasteful to use 4-byte wchar_t strings to carry UTF-16 data, and it's
// entirely improper on those systems where the encoding of wchar_t is defined
// as UTF-32.
//
// Here, we define string16, which is similar to std::wstring but replaces all
// libc functions with custom, 2-byte-char compatible routines. It is capable
// of carrying UTF-16-encoded data.
#include <stdio.h>
#include <string>
#include "include/base/cef_basictypes.h"
#if defined(WCHAR_T_IS_UTF16)
namespace base {
typedef wchar_t char16;
typedef std::wstring string16;
typedef std::char_traits<wchar_t> string16_char_traits;
} // namespace base
#elif defined(WCHAR_T_IS_UTF32)
#include <stdint.h> // For uint16_t
#include "include/base/cef_macros.h"
namespace cef {
namespace base {
typedef uint16_t char16;
// char16 versions of the functions required by string16_char_traits; these
// are based on the wide character functions of similar names ("w" or "wcs"
// instead of "c16").
int c16memcmp(const char16* s1, const char16* s2, size_t n);
size_t c16len(const char16* s);
const char16* c16memchr(const char16* s, char16 c, size_t n);
char16* c16memmove(char16* s1, const char16* s2, size_t n);
char16* c16memcpy(char16* s1, const char16* s2, size_t n);
char16* c16memset(char16* s, char16 c, size_t n);
struct string16_char_traits {
typedef char16 char_type;
typedef int int_type;
// int_type needs to be able to hold each possible value of char_type, and in
// addition, the distinct value of eof().
COMPILE_ASSERT(sizeof(int_type) > sizeof(char_type), unexpected_type_width);
typedef std::streamoff off_type;
typedef mbstate_t state_type;
typedef std::fpos<state_type> pos_type;
static void assign(char_type& c1, const char_type& c2) { c1 = c2; }
static bool eq(const char_type& c1, const char_type& c2) { return c1 == c2; }
static bool lt(const char_type& c1, const char_type& c2) { return c1 < c2; }
static int compare(const char_type* s1, const char_type* s2, size_t n) {
return c16memcmp(s1, s2, n);
}
static size_t length(const char_type* s) { return c16len(s); }
static const char_type* find(const char_type* s,
size_t n,
const char_type& a) {
return c16memchr(s, a, n);
}
static char_type* move(char_type* s1, const char_type* s2, int_type n) {
return c16memmove(s1, s2, n);
}
static char_type* copy(char_type* s1, const char_type* s2, size_t n) {
return c16memcpy(s1, s2, n);
}
static char_type* assign(char_type* s, size_t n, char_type a) {
return c16memset(s, a, n);
}
static int_type not_eof(const int_type& c) {
return eq_int_type(c, eof()) ? 0 : c;
}
static char_type to_char_type(const int_type& c) { return char_type(c); }
static int_type to_int_type(const char_type& c) { return int_type(c); }
static bool eq_int_type(const int_type& c1, const int_type& c2) {
return c1 == c2;
}
static int_type eof() { return static_cast<int_type>(EOF); }
};
typedef std::basic_string<char16, string16_char_traits> string16;
} // namespace base
} // namespace cef
namespace base {
typedef cef::base::char16 char16;
typedef cef::base::string16 string16;
extern std::ostream& operator<<(std::ostream& out, const string16& str);
// This is required by googletest to print a readable output on test failures.
extern void PrintTo(const string16& str, std::ostream* out);
} // namespace base
// The string class will be explicitly instantiated only once, in string16.cc.
//
// std::basic_string<> in GNU libstdc++ contains a static data member,
// _S_empty_rep_storage, to represent empty strings. When an operation such
// as assignment or destruction is performed on a string, causing its existing
// data member to be invalidated, it must not be freed if this static data
// member is being used. Otherwise, it counts as an attempt to free static
// (and not allocated) data, which is a memory error.
//
// Generally, due to C++ template magic, _S_empty_rep_storage will be marked
// as a coalesced symbol, meaning that the linker will combine multiple
// instances into a single one when generating output.
//
// If a string class is used by multiple shared libraries, a problem occurs.
// Each library will get its own copy of _S_empty_rep_storage. When strings
// are passed across a library boundary for alteration or destruction, memory
// errors will result. GNU libstdc++ contains a configuration option,
// --enable-fully-dynamic-string (_GLIBCXX_FULLY_DYNAMIC_STRING), which
// disables the static data member optimization, but it's a good optimization
// and non-STL code is generally at the mercy of the system's STL
// configuration. Fully-dynamic strings are not the default for GNU libstdc++
// libstdc++ itself or for the libstdc++ installations on the systems we care
// about, such as Mac OS X and relevant flavors of Linux.
//
// See also http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24196 .
//
// To avoid problems, string classes need to be explicitly instantiated only
// once, in exactly one library. All other string users see it via an "extern"
// declaration. This is precisely how GNU libstdc++ handles
// std::basic_string<char> (string) and std::basic_string<wchar_t> (wstring).
//
// This also works around a Mac OS X linker bug in ld64-85.2.1 (Xcode 3.1.2),
// in which the linker does not fully coalesce symbols when dead code
// stripping is enabled. This bug causes the memory errors described above
// to occur even when a std::basic_string<> does not cross shared library
// boundaries, such as in statically-linked executables.
//
// TODO(mark): File this bug with Apple and update this note with a bug number.
extern template class std::basic_string<cef::base::char16,
cef::base::string16_char_traits>;
#endif // WCHAR_T_IS_UTF32
#endif // !USING_CHROMIUM_INCLUDES
#endif // CEF_INCLUDE_BASE_CEF_STRING16_H_

View File

@ -34,7 +34,6 @@
#include <memory.h>
#include <string>
#include "include/base/cef_string16.h"
#include "include/internal/cef_string_types.h"
#if defined(USING_CHROMIUM_INCLUDES)
@ -91,32 +90,34 @@ struct CefStringTraitsWide {
: false;
}
#if defined(WCHAR_T_IS_UTF32)
static inline base::string16 to_string16(const struct_type* s) {
static inline std::u16string to_string16(const struct_type* s) {
cef_string_utf16_t cstr;
memset(&cstr, 0, sizeof(cstr));
cef_string_wide_to_utf16(s->str, s->length, &cstr);
base::string16 str;
std::u16string str;
if (cstr.length > 0) {
str = base::string16(
reinterpret_cast<base::string16::value_type*>(cstr.str), cstr.length);
str = std::u16string(
reinterpret_cast<std::u16string::value_type*>(cstr.str), cstr.length);
}
cef_string_utf16_clear(&cstr);
return str;
}
static inline bool from_string16(const base::string16& str, struct_type* s) {
static inline bool from_string16(const std::u16string& str, struct_type* s) {
return cef_string_utf16_to_wide(
reinterpret_cast<const char16*>(str.c_str()), str.length(), s)
? true
: false;
}
#else // WCHAR_T_IS_UTF32
static inline base::string16 to_string16(const struct_type* s) {
return base::string16(
reinterpret_cast<const base::string16::value_type*>(s->str), s->length);
static inline std::u16string to_string16(const struct_type* s) {
return std::u16string(
reinterpret_cast<const std::u16string::value_type*>(s->str), s->length);
}
static inline bool from_string16(const base::string16& str, struct_type* s) {
return cef_string_wide_set(str.c_str(), str.length(), s, true) ? true
: false;
static inline bool from_string16(const std::u16string& str, struct_type* s) {
return cef_string_wide_set(reinterpret_cast<const wchar_t*>(str.c_str()),
str.length(), s, true)
? true
: false;
}
#endif // WCHAR_T_IS_UTF32
};
@ -169,19 +170,19 @@ struct CefStringTraitsUTF8 {
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
return cef_string_wide_to_utf8(str.c_str(), str.length(), s) ? true : false;
}
static inline base::string16 to_string16(const struct_type* s) {
static inline std::u16string to_string16(const struct_type* s) {
cef_string_utf16_t cstr;
memset(&cstr, 0, sizeof(cstr));
cef_string_utf8_to_utf16(s->str, s->length, &cstr);
base::string16 str;
std::u16string str;
if (cstr.length > 0) {
str = base::string16(
reinterpret_cast<base::string16::value_type*>(cstr.str), cstr.length);
str = std::u16string(
reinterpret_cast<std::u16string::value_type*>(cstr.str), cstr.length);
}
cef_string_utf16_clear(&cstr);
return str;
}
static inline bool from_string16(const base::string16& str, struct_type* s) {
static inline bool from_string16(const std::u16string& str, struct_type* s) {
return cef_string_utf16_to_utf8(
reinterpret_cast<const char16*>(str.c_str()), str.length(), s)
? true
@ -256,11 +257,11 @@ struct CefStringTraitsUTF16 {
: false;
}
#endif // WCHAR_T_IS_UTF32
static inline base::string16 to_string16(const struct_type* s) {
return base::string16(
reinterpret_cast<const base::string16::value_type*>(s->str), s->length);
static inline std::u16string to_string16(const struct_type* s) {
return std::u16string(
reinterpret_cast<const std::u16string::value_type*>(s->str), s->length);
}
static inline bool from_string16(const base::string16& str, struct_type* s) {
static inline bool from_string16(const std::u16string& str, struct_type* s) {
return cef_string_utf16_set(reinterpret_cast<const char16*>(str.c_str()),
str.length(), s, true)
? true
@ -341,19 +342,25 @@ class CefStringBase {
FromWString(std::wstring(src));
}
#if defined(WCHAR_T_IS_UTF32)
///
// Create a new string from an existing string16. Data will be always
// copied. Translation will occur if necessary based on the underlying string
// type.
///
CefStringBase(const base::string16& src) : string_(NULL), owner_(false) {
CefStringBase(const std::u16string& src) : string_(NULL), owner_(false) {
FromString16(src);
}
CefStringBase(const char16* src) : string_(NULL), owner_(false) {
CefStringBase(const std::u16string::value_type* src)
: string_(NULL), owner_(false) {
if (src)
FromString16(base::string16(
reinterpret_cast<const base::string16::value_type*>(src)));
FromString16(std::u16string(src));
}
#if defined(WCHAR_T_IS_UTF32)
CefStringBase(const char16* src) : string_(NULL), owner_(false) {
if (src) {
FromString16(std::u16string(
reinterpret_cast<const std::u16string::value_type*>(src)));
}
}
#endif // WCHAR_T_IS_UTF32
@ -620,9 +627,9 @@ class CefStringBase {
// Return this string's data as a string16. Translation will occur if
// necessary based on the underlying string type.
///
base::string16 ToString16() const {
std::u16string ToString16() const {
if (empty())
return base::string16();
return std::u16string();
return traits::to_string16(string_);
}
@ -631,7 +638,7 @@ class CefStringBase {
// copied. Translation will occur if necessary based on the underlying string
// type.
///
bool FromString16(const base::string16& str) {
bool FromString16(const std::u16string& str) {
if (str.empty()) {
clear();
return true;
@ -683,15 +690,19 @@ class CefStringBase {
FromWString(std::wstring(str));
return *this;
}
#if defined(WCHAR_T_IS_UTF32)
operator base::string16() const { return ToString16(); }
CefStringBase& operator=(const base::string16& str) {
operator std::u16string() const { return ToString16(); }
CefStringBase& operator=(const std::u16string& str) {
FromString16(str);
return *this;
}
CefStringBase& operator=(const std::u16string::value_type* str) {
FromString16(std::u16string(str));
return *this;
}
#if defined(WCHAR_T_IS_UTF32)
CefStringBase& operator=(const char16* str) {
FromString16(base::string16(
reinterpret_cast<const base::string16::value_type*>(str)));
FromString16(std::u16string(
reinterpret_cast<const std::u16string::value_type*>(str)));
return *this;
}
#endif // WCHAR_T_IS_UTF32

View File

@ -309,16 +309,6 @@ AlloyBrowserContext::GetClientHintsControllerDelegate() {
return nullptr;
}
void AlloyBrowserContext::SetCorsOriginAccessListForOrigin(
TargetBrowserContexts target_mode,
const url::Origin& source_origin,
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
base::OnceClosure closure) {
// This method is called for Extension support.
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, std::move(closure));
}
ChromeZoomLevelPrefs* AlloyBrowserContext::GetZoomLevelPrefs() {
return static_cast<ChromeZoomLevelPrefs*>(
GetStoragePartition(this, nullptr)->GetZoomLevelDelegate());

View File

@ -60,12 +60,6 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
content::ResourceContext* GetResourceContext() override;
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
override;
void SetCorsOriginAccessListForOrigin(
TargetBrowserContexts target_mode,
const url::Origin& source_origin,
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
base::OnceClosure closure) override;
base::FilePath GetPath() override;
base::FilePath GetPath() const override;
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(

View File

@ -1191,9 +1191,9 @@ void AlloyBrowserHostImpl::UpdateTargetURL(content::WebContents* source,
bool AlloyBrowserHostImpl::DidAddMessageToConsole(
content::WebContents* source,
blink::mojom::ConsoleMessageLevel level,
const base::string16& message,
const std::u16string& message,
int32_t line_no,
const base::string16& source_id) {
const std::u16string& source_id) {
return contents_delegate_->DidAddMessageToConsole(source, level, message,
line_no, source_id);
}

View File

@ -22,12 +22,11 @@
#include "libcef/browser/menu_manager.h"
#include "libcef/browser/request_context_impl.h"
#include "base/strings/string16.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "extensions/common/view_type.h"
#include "extensions/common/mojom/view_type.mojom-forward.h"
class CefAudioCapturer;
class CefBrowserInfo;
@ -222,9 +221,9 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
bool DidAddMessageToConsole(content::WebContents* source,
blink::mojom::ConsoleMessageLevel log_level,
const base::string16& message,
const std::u16string& message,
int32_t line_no,
const base::string16& source_id) override;
const std::u16string& source_id) override;
void BeforeUnloadFired(content::WebContents* source,
bool proceed,
bool* proceed_to_fire_unload) override;

View File

@ -25,6 +25,7 @@
#include "base/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"
#include "chrome/browser/net/system_network_context_manager.h"
@ -152,7 +153,7 @@ int AlloyBrowserMainParts::PreCreateThreads() {
return 0;
}
void AlloyBrowserMainParts::PreMainMessageLoopRun() {
int AlloyBrowserMainParts::PreMainMessageLoopRun() {
#if defined(USE_AURA)
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
#endif
@ -173,14 +174,14 @@ void AlloyBrowserMainParts::PreMainMessageLoopRun() {
// ChromeBrowserMainExtraPartsProfiles for details.
cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
background_task_runner_ = base::CreateSingleThreadTaskRunner(
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
background_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
{base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
user_visible_task_runner_ = base::CreateSingleThreadTaskRunner(
{base::ThreadPool(), base::TaskPriority::USER_VISIBLE,
user_visible_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
{base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
user_blocking_task_runner_ = base::CreateSingleThreadTaskRunner(
{base::ThreadPool(), base::TaskPriority::USER_BLOCKING,
user_blocking_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
{base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
CefRequestContextSettings settings;
@ -204,6 +205,8 @@ void AlloyBrowserMainParts::PreMainMessageLoopRun() {
PluginFinder::GetInstance()->Init();
scheme::RegisterWebUIControllerFactory();
return content::RESULT_CODE_NORMAL_EXIT;
}
void AlloyBrowserMainParts::PostMainMessageLoopRun() {

View File

@ -50,7 +50,7 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
void PreMainMessageLoopStart() override;
void PostMainMessageLoopStart() override;
int PreCreateThreads() override;
void PreMainMessageLoopRun() override;
int PreMainMessageLoopRun() override;
void PostMainMessageLoopRun() override;
void PostDestroyThreads() override;

View File

@ -988,9 +988,9 @@ void AlloyContentBrowserClient::DidCreatePpapiPlugin(
new ChromeBrowserPepperHostFactory(browser_host)));
}
content::DevToolsManagerDelegate*
AlloyContentBrowserClient::GetDevToolsManagerDelegate() {
return new CefDevToolsManagerDelegate();
std::unique_ptr<content::DevToolsManagerDelegate>
AlloyContentBrowserClient::CreateDevToolsManagerDelegate() {
return std::make_unique<CefDevToolsManagerDelegate>();
}
std::vector<std::unique_ptr<content::NavigationThrottle>>
@ -1244,6 +1244,7 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
const GURL& url,
content::WebContents::OnceGetter web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,

View File

@ -109,7 +109,8 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
std::string GetDefaultDownloadName() override;
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
std::unique_ptr<content::DevToolsManagerDelegate>
CreateDevToolsManagerDelegate() override;
std::vector<std::unique_ptr<content::NavigationThrottle>>
CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) override;
@ -179,6 +180,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
const GURL& url,
content::WebContents::OnceGetter web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,

View File

@ -68,10 +68,11 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
extensions::GetExtensionForUrl(browser_context, gurl);
}
if (create_params.extension) {
if (create_params.extension_host_type == extensions::VIEW_TYPE_INVALID) {
if (create_params.extension_host_type ==
extensions::mojom::ViewType::kInvalid) {
// Default to dialog behavior.
create_params.extension_host_type =
extensions::VIEW_TYPE_EXTENSION_DIALOG;
extensions::mojom::ViewType::kExtensionDialog;
}
// Extension resources will fail to load if we don't use a SiteInstance
@ -191,7 +192,7 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
const extensions::Extension* extension,
const GURL& url,
extensions::ViewType host_type) {
extensions::mojom::ViewType host_type) {
REQUIRE_ALLOY_RUNTIME();
DCHECK(primary_);
@ -202,14 +203,15 @@ void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
auto alloy_browser = static_cast<AlloyBrowserHostImpl*>(browser_);
if (host_type == extensions::VIEW_TYPE_EXTENSION_DIALOG ||
host_type == extensions::VIEW_TYPE_EXTENSION_POPUP) {
if (host_type == extensions::mojom::ViewType::kExtensionDialog ||
host_type == extensions::mojom::ViewType::kExtensionPopup) {
// Create an extension host that we own.
extension_host_ = new extensions::CefExtensionViewHost(
alloy_browser, extension, web_contents_, url, host_type);
// Trigger load of the extension URL.
extension_host_->CreateRendererSoon();
} else if (host_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
} else if (host_type ==
extensions::mojom::ViewType::kExtensionBackgroundPage) {
is_background_host_ = true;
alloy_browser->is_background_host_ = true;
// Create an extension host that will be owned by ProcessManager.
@ -451,7 +453,7 @@ void CefBrowserPlatformDelegateAlloy::DestroyExtensionHost() {
if (!extension_host_)
return;
if (extension_host_->extension_host_type() ==
extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
extensions::mojom::ViewType::kExtensionBackgroundPage) {
DCHECK(is_background_host_);
// Close notification for background pages arrives via CloseContents.
// The extension host will be deleted by

View File

@ -33,7 +33,7 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
void BrowserCreated(CefBrowserHostBase* browser) override;
void CreateExtensionHost(const extensions::Extension* extension,
const GURL& url,
extensions::ViewType host_type) override;
extensions::mojom::ViewType host_type) override;
extensions::ExtensionHost* GetExtensionHost() const override;
void BrowserDestroyed(CefBrowserHostBase* browser) override;
void SendCaptureLostEvent() override;

View File

@ -71,7 +71,8 @@ std::string ChromeProfileAlloy::GetProfileUserName() const {
}
Profile* ChromeProfileAlloy::GetOffTheRecordProfile(
const Profile::OTRProfileID& otr_profile_id) {
const Profile::OTRProfileID& otr_profile_id,
bool create_if_needed) {
NOTREACHED();
return nullptr;
}

View File

@ -26,8 +26,8 @@ class ChromeProfileAlloy : public Profile {
variations::VariationsClient* GetVariationsClient() override;
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
std::string GetProfileUserName() const override;
Profile* GetOffTheRecordProfile(
const Profile::OTRProfileID& otr_profile_id) override;
Profile* GetOffTheRecordProfile(const Profile::OTRProfileID& otr_profile_id,
bool create_if_needed) override;
std::vector<Profile*> GetAllOffTheRecordProfiles() override;
void DestroyOffTheRecordProfile(Profile* otr_profile) override;
bool HasOffTheRecordProfile(

View File

@ -16,6 +16,7 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_view_host.h"
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
using content::KeyboardEventProcessingResult;
@ -127,9 +128,9 @@ void CefBrowserContentsDelegate::UpdateTargetURL(content::WebContents* source,
bool CefBrowserContentsDelegate::DidAddMessageToConsole(
content::WebContents* source,
blink::mojom::ConsoleMessageLevel log_level,
const base::string16& message,
const std::u16string& message,
int32_t line_no,
const base::string16& source_id) {
const std::u16string& source_id) {
if (auto c = client()) {
if (auto handler = c->GetDisplayHandler()) {
// Use LOGSEVERITY_DEBUG for unrecognized |level| values.
@ -328,7 +329,8 @@ void CefBrowserContentsDelegate::OnFrameFocused(
OnStateChanged(State::kFocusedFrame);
}
void CefBrowserContentsDelegate::DocumentAvailableInMainFrame() {
void CefBrowserContentsDelegate::DocumentAvailableInMainFrame(
content::RenderFrameHost* render_frame_host) {
has_document_ = true;
OnStateChanged(State::kDocument);
@ -592,7 +594,7 @@ void CefBrowserContentsDelegate::OnLoadError(CefRefPtr<CefFrame> frame,
}
}
void CefBrowserContentsDelegate::OnTitleChange(const base::string16& title) {
void CefBrowserContentsDelegate::OnTitleChange(const std::u16string& title) {
if (auto c = client()) {
if (auto handler = c->GetDisplayHandler()) {
handler->OnTitleChange(browser(), title);

View File

@ -87,9 +87,9 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
bool DidAddMessageToConsole(content::WebContents* source,
blink::mojom::ConsoleMessageLevel log_level,
const base::string16& message,
const std::u16string& message,
int32_t line_no,
const base::string16& source_id) override;
const std::u16string& source_id) override;
void DidNavigateMainFramePostCommit(
content::WebContents* web_contents) override;
void EnterFullscreenModeForTab(
@ -112,7 +112,8 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
void RenderViewReady() override;
void RenderProcessGone(base::TerminationStatus status) override;
void OnFrameFocused(content::RenderFrameHost* render_frame_host) override;
void DocumentAvailableInMainFrame() override;
void DocumentAvailableInMainFrame(
content::RenderFrameHost* render_frame_host) override;
void LoadProgressChanged(double progress) override;
void DidStopLoading() override;
void DidFinishNavigation(
@ -163,7 +164,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
void OnLoadStart(CefRefPtr<CefFrame> frame,
ui::PageTransition transition_type);
void OnLoadError(CefRefPtr<CefFrame> frame, const GURL& url, int error_code);
void OnTitleChange(const base::string16& title);
void OnTitleChange(const std::u16string& title);
void OnFullscreenModeChange(bool fullscreen);
void OnStateChanged(State state_changed);

View File

@ -18,7 +18,7 @@
#include "base/observer_list.h"
#include "base/synchronization/lock.h"
#include "extensions/common/view_type.h"
#include "extensions/common/mojom/view_type.mojom.h"
namespace extensions {
class Extension;
@ -86,7 +86,8 @@ struct CefBrowserCreateParams {
// ProcessManager::CreateBackgroundHost. Currently used with the alloy
// runtime only.
const extensions::Extension* extension = nullptr;
extensions::ViewType extension_host_type = extensions::VIEW_TYPE_INVALID;
extensions::mojom::ViewType extension_host_type =
extensions::mojom::ViewType::kInvalid;
};
// Base class for CefBrowserHost implementations. Includes functionality that is

View File

@ -76,7 +76,7 @@ void CefBrowserPlatformDelegate::BrowserCreated(CefBrowserHostBase* browser) {
void CefBrowserPlatformDelegate::CreateExtensionHost(
const extensions::Extension* extension,
const GURL& url,
extensions::ViewType host_type) {
extensions::mojom::ViewType host_type) {
NOTREACHED();
}

View File

@ -15,7 +15,7 @@
#include "include/views/cef_browser_view.h"
#include "base/callback_forward.h"
#include "extensions/common/view_type.h"
#include "extensions/common/mojom/view_type.mojom-forward.h"
#include "third_party/blink/public/common/page/drag_operation.h"
#include "third_party/blink/public/mojom/page/drag.mojom-forward.h"
#include "third_party/skia/include/core/SkColor.h"
@ -134,7 +134,7 @@ class CefBrowserPlatformDelegate {
// Called from AlloyBrowserHostImpl::Create.
virtual void CreateExtensionHost(const extensions::Extension* extension,
const GURL& url,
extensions::ViewType host_type);
extensions::mojom::ViewType host_type);
// Returns the current extension host.
virtual extensions::ExtensionHost* GetExtensionHost() const;

View File

@ -115,7 +115,7 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
}
return std::move(native_delegate);
} else if (create_params.extension_host_type ==
extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
extensions::mojom::ViewType::kExtensionBackgroundPage) {
// Creating a background extension host without a window.
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
CreateNativeDelegate(CefWindowInfo(), background_color);

View File

@ -57,10 +57,8 @@ void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
// Create or load a specific disk-based profile. May continue
// synchronously or asynchronously.
profile_manager->CreateProfileAsync(
cache_path_,
base::Bind(&ChromeBrowserContext::ProfileCreated,
weak_ptr_factory_.GetWeakPtr()),
/*name=*/base::string16(), /*icon_url=*/std::string());
cache_path_, base::Bind(&ChromeBrowserContext::ProfileCreated,
weak_ptr_factory_.GetWeakPtr()));
return;
} else {
// All profile directories must be relative to |user_data_dir|.

View File

@ -156,9 +156,9 @@ void ChromeBrowserDelegate::UpdateTargetURL(content::WebContents* source,
bool ChromeBrowserDelegate::DidAddMessageToConsole(
content::WebContents* source,
blink::mojom::ConsoleMessageLevel log_level,
const base::string16& message,
const std::u16string& message,
int32_t line_no,
const base::string16& source_id) {
const std::u16string& source_id) {
if (auto delegate = GetDelegateForWebContents(source)) {
return delegate->DidAddMessageToConsole(source, log_level, message, line_no,
source_id);

View File

@ -70,9 +70,9 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
bool DidAddMessageToConsole(content::WebContents* source,
blink::mojom::ConsoleMessageLevel log_level,
const base::string16& message,
const std::u16string& message,
int32_t line_no,
const base::string16& source_id) override;
const std::u16string& source_id) override;
void DidNavigateMainFramePostCommit(
content::WebContents* web_contents) override;
void EnterFullscreenModeForTab(

View File

@ -9,6 +9,7 @@
#include "libcef/browser/net/chrome_scheme_handler.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
@ -24,14 +25,14 @@ void ChromeBrowserMainExtraPartsCef::PostProfileInit() {
}
void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() {
background_task_runner_ = base::CreateSingleThreadTaskRunner(
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
background_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
{base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
user_visible_task_runner_ = base::CreateSingleThreadTaskRunner(
{base::ThreadPool(), base::TaskPriority::USER_VISIBLE,
user_visible_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
{base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
user_blocking_task_runner_ = base::CreateSingleThreadTaskRunner(
{base::ThreadPool(), base::TaskPriority::USER_BLOCKING,
user_blocking_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
{base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
scheme::RegisterWebUIControllerFactory();

View File

@ -40,13 +40,15 @@ namespace {
void HandleExternalProtocolHelper(
ChromeContentBrowserClientCef* self,
content::WebContents::OnceGetter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
const network::ResourceRequest& resource_request) {
// Match the logic of the original call in
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
self->HandleExternalProtocol(
resource_request.url, std::move(web_contents_getter),
content::ChildProcessHost::kInvalidUniqueID, navigation_data,
content::ChildProcessHost::kInvalidUniqueID, frame_tree_node_id,
navigation_data,
resource_request.resource_type ==
static_cast<int>(blink::mojom::ResourceType::kMainFrame),
static_cast<ui::PageTransition>(resource_request.transition_type),
@ -227,6 +229,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
const GURL& url,
content::WebContents::OnceGetter web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,
@ -244,9 +247,9 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
// HandleExternalProtocolHelper. Forward to the chrome layer for default
// handling.
return ChromeContentBrowserClient::HandleExternalProtocol(
url, std::move(web_contents_getter), child_id, navigation_data,
is_main_frame, page_transition, has_user_gesture, initiating_origin,
nullptr);
url, std::move(web_contents_getter), child_id, frame_tree_node_id,
navigation_data, is_main_frame, page_transition, has_user_gesture,
initiating_origin, nullptr);
}
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
@ -262,7 +265,8 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
auto request_handler = net_service::CreateInterceptedRequestHandler(
web_contents_getter, frame_tree_node_id, resource_request,
base::Bind(HandleExternalProtocolHelper, base::Unretained(this),
web_contents_getter, navigation_data, resource_request));
web_contents_getter, frame_tree_node_id, navigation_data,
resource_request));
net_service::ProxyURLLoaderFactory::CreateProxy(
web_contents_getter, std::move(receiver), std::move(request_handler));

View File

@ -60,6 +60,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
const GURL& url,
content::WebContents::OnceGetter web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,

View File

@ -119,7 +119,7 @@ bool CefContextMenuParamsImpl::GetDictionarySuggestions(
if (const_value().dictionary_suggestions.empty())
return false;
std::vector<base::string16>::const_iterator it =
std::vector<std::u16string>::const_iterator it =
const_value().dictionary_suggestions.begin();
for (; it != const_value().dictionary_suggestions.end(); ++it)
suggestions.push_back(*it);

View File

@ -91,7 +91,7 @@ void CefDevToolsController::RemoveObserver(Observer* observer) {
void CefDevToolsController::DispatchProtocolMessage(
content::DevToolsAgentHost* agent_host,
base::span<const uint8_t> message) {
if (!observers_.might_have_observers())
if (observers_.empty())
return;
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),

View File

@ -15,6 +15,7 @@
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/util/values/values_util.h"
#include "base/values.h"
@ -44,8 +45,8 @@ CefDevToolsFileManager::CefDevToolsFileManager(
PrefService* prefs)
: browser_impl_(browser_impl),
prefs_(prefs),
file_task_runner_(base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::MayBlock()})),
file_task_runner_(
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()})),
weak_factory_(this) {}
void CefDevToolsFileManager::SaveToFile(const std::string& url,

View File

@ -338,7 +338,8 @@ void CefDevToolsFrontend::ReadyToCommitNavigation(
content::DevToolsFrontendHost::SetupExtensionsAPI(frame, script);
}
void CefDevToolsFrontend::DocumentAvailableInMainFrame() {
void CefDevToolsFrontend::DocumentAvailableInMainFrame(
content::RenderFrameHost* render_frame_host) {
// Don't call AttachClient multiple times for the same DevToolsAgentHost.
// Otherwise it will call AgentHostClosed which closes the DevTools window.
// This may happen in cases where the DevTools content fails to load.
@ -390,8 +391,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
this, base::as_bytes(base::make_span(protocol_message)));
} else if (method == "loadCompleted") {
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"),
base::NullCallback());
u"DevToolsAPI.setUseSoftMenu(true);", base::NullCallback());
} else if (method == "loadNetworkResource" && params->GetSize() == 3) {
// TODO(pfeldman): handle some of the embedder messages in content.
std::string url;
@ -461,7 +461,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
SendMessageAck(request_id, &response);
return;
} else {
auto* partition = content::BrowserContext::GetStoragePartitionForSite(
auto* partition = content::BrowserContext::GetStoragePartitionForUrl(
web_contents()->GetBrowserContext(), gurl);
url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
}
@ -493,8 +493,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
update.Get()->RemoveWithoutPathExpansion(name, nullptr);
} else if (method == "requestFileSystems") {
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"),
base::NullCallback());
u"DevToolsAPI.fileSystemsLoaded([]);", base::NullCallback());
} else if (method == "reattach") {
if (!agent_host_)
return;
@ -550,7 +549,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
std::string param;
base::EscapeJSONString(str_message, true, &param);
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
base::string16 javascript = base::UTF8ToUTF16(code);
std::u16string javascript = base::UTF8ToUTF16(code);
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
javascript, base::NullCallback());
return;
@ -564,7 +563,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
&param);
std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," +
std::to_string(pos ? 0 : total_size) + ");";
base::string16 javascript = base::UTF8ToUTF16(code);
std::u16string javascript = base::UTF8ToUTF16(code);
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
javascript, base::NullCallback());
}

View File

@ -76,7 +76,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
// WebContentsObserver overrides
void ReadyToCommitNavigation(
content::NavigationHandle* navigation_handle) override;
void DocumentAvailableInMainFrame() override;
void DocumentAvailableInMainFrame(
content::RenderFrameHost* render_frame_host) override;
void WebContentsDestroyed() override;
void SendMessageAck(int request_id, const base::Value* arg1);

View File

@ -56,7 +56,7 @@ void SyncValueStoreCache::RunWithValueStoreForExtension(
// A neat way to implement unlimited storage; if the extension has the
// unlimited storage permission, force through all calls to Set().
if (extension->permissions_data()->HasAPIPermission(
APIPermission::kUnlimitedStorage)) {
mojom::APIPermissionID::kUnlimitedStorage)) {
WeakUnlimitedSettingsStorage unlimited_storage(storage);
std::move(callback).Run(&unlimited_storage);
} else {

View File

@ -128,7 +128,8 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
execute_tab_id_ = browser->GetIdentifier();
details_ = std::move(details);
set_host_id(HostID(HostID::EXTENSIONS, extension()->id()));
set_host_id(
mojom::HostID(mojom::HostID::HostType::kExtensions, extension()->id()));
return set_init_result(SUCCESS);
}
@ -182,7 +183,7 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage(std::string* error) {
execute_tab_id_, error)) {
if (is_about_url &&
extension()->permissions_data()->active_permissions().HasAPIPermission(
APIPermission::kTab)) {
mojom::APIPermissionID::kTab)) {
*error = ErrorUtils::FormatErrorMessage(
manifest_errors::kCannotAccessAboutUrl,
rfh->GetLastCommittedURL().spec(),

View File

@ -23,7 +23,7 @@ CefComponentExtensionResourceManager::CefComponentExtensionResourceManager() {
base::Value dict(base::Value::Type::DICTIONARY);
pdf_extension_util::AddStrings(
pdf_extension_util::PdfViewerContext::kPdfViewer, &dict);
pdf_extension_util::AddAdditionalData(&dict);
pdf_extension_util::AddAdditionalData(/*enable_annotations=*/true, &dict);
ui::TemplateReplacements pdf_viewer_replacements;
ui::TemplateReplacementsFromDictionaryValue(

View File

@ -17,7 +17,7 @@ CefExtensionBackgroundHost::CefExtensionBackgroundHost(
const Extension* extension,
content::WebContents* host_contents,
const GURL& url,
ViewType host_type)
mojom::ViewType host_type)
: ExtensionHost(new CefExtensionHostDelegate(browser),
extension,
host_contents->GetBrowserContext(),
@ -28,7 +28,7 @@ CefExtensionBackgroundHost::CefExtensionBackgroundHost(
DCHECK(!deleted_callback_.is_null());
// Only used for background pages.
DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE);
DCHECK(host_type == mojom::ViewType::kExtensionBackgroundPage);
}
CefExtensionBackgroundHost::~CefExtensionBackgroundHost() {

View File

@ -29,7 +29,7 @@ class CefExtensionBackgroundHost : public ExtensionHost {
const Extension* extension,
content::WebContents* host_contents,
const GURL& url,
ViewType host_type);
mojom::ViewType host_type);
~CefExtensionBackgroundHost() override;
// content::WebContentsDelegate methods:

View File

@ -12,6 +12,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
@ -81,10 +82,9 @@ class CefGetExtensionLoadFileCallbackImpl
return;
}
base::PostTaskAndReplyWithResult(
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE,
{base::ThreadPool(), base::MayBlock(),
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
{base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::BindOnce(LoadFileFromStream, file, stream), std::move(callback));
}

View File

@ -547,7 +547,8 @@ scoped_refptr<const Extension> CefExtensionSystem::CreateExtension(
// Tests should continue to use the Manifest::COMMAND_LINE value here
// Some Chrome APIs will cause undesired effects if this is incorrect
// e.g.: alarms API has 1 minute minimum applied to Packed Extensions
info.internal ? Manifest::COMPONENT : Manifest::COMMAND_LINE,
info.internal ? mojom::ManifestLocation::kComponent
: mojom::ManifestLocation::kCommandLine,
*info.manifest, flags, utf8_error);
}

View File

@ -25,7 +25,7 @@ CefExtensionViewHost::CefExtensionViewHost(AlloyBrowserHostImpl* browser,
const Extension* extension,
content::WebContents* host_contents,
const GURL& url,
ViewType host_type)
mojom::ViewType host_type)
: ExtensionHost(new CefExtensionHostDelegate(browser),
extension,
host_contents->GetBrowserContext(),
@ -33,8 +33,8 @@ CefExtensionViewHost::CefExtensionViewHost(AlloyBrowserHostImpl* browser,
url,
host_type) {
// Only used for dialogs and popups.
DCHECK(host_type == VIEW_TYPE_EXTENSION_DIALOG ||
host_type == VIEW_TYPE_EXTENSION_POPUP);
DCHECK(host_type == mojom::ViewType::kExtensionDialog ||
host_type == mojom::ViewType::kExtensionPopup);
}
CefExtensionViewHost::~CefExtensionViewHost() {}
@ -76,7 +76,7 @@ bool CefExtensionViewHost::PreHandleGestureEvent(
}
WebContents* CefExtensionViewHost::GetVisibleWebContents() const {
if (extension_host_type() == VIEW_TYPE_EXTENSION_POPUP)
if (extension_host_type() == mojom::ViewType::kExtensionPopup)
return host_contents();
return nullptr;
}

View File

@ -31,7 +31,7 @@ class CefExtensionViewHost : public ExtensionHost,
const Extension* extension,
content::WebContents* host_contents,
const GURL& url,
ViewType host_type);
mojom::ViewType host_type);
~CefExtensionViewHost() override;
// ExtensionHost methods:

View File

@ -264,8 +264,7 @@ bool CefExtensionsBrowserClient::CreateBackgroundExtensionHost(
// This triggers creation of the background host.
create_params.extension = extension;
create_params.extension_host_type =
extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE;
create_params.extension_host_type = mojom::ViewType::kExtensionBackgroundPage;
// Browser creation may fail under certain rare circumstances. Fail the
// background host creation in that case.

View File

@ -92,17 +92,17 @@ ValueStore::WriteResult CefValueStore::Set(
if (!status_.ok())
return WriteResult(CreateStatusCopy(status_));
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
ValueStoreChangeList changes;
for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd();
it.Advance()) {
base::Value* old_value = nullptr;
base::Value* old_value = NULL;
if (!storage_.GetWithoutPathExpansion(it.key(), &old_value) ||
!old_value->Equals(&it.value())) {
changes->push_back(ValueStoreChange(
it.key(),
old_value ? base::Optional<base::Value>(old_value->Clone())
: base::nullopt,
it.value().Clone()));
changes.emplace_back(it.key(),
old_value
? base::Optional<base::Value>(old_value->Clone())
: base::nullopt,
it.value().Clone());
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
}
}
@ -119,13 +119,11 @@ ValueStore::WriteResult CefValueStore::Remove(
if (!status_.ok())
return WriteResult(CreateStatusCopy(status_));
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
for (std::vector<std::string>::const_iterator it = keys.begin();
it != keys.end(); ++it) {
ValueStoreChangeList changes;
for (auto it = keys.cbegin(); it != keys.cend(); ++it) {
std::unique_ptr<base::Value> old_value;
if (storage_.RemoveWithoutPathExpansion(*it, &old_value)) {
changes->push_back(
ValueStoreChange(*it, std::move(*old_value), base::nullopt));
changes.emplace_back(*it, std::move(*old_value), base::nullopt);
}
}
return WriteResult(std::move(changes), CreateStatusCopy(status_));

View File

@ -274,7 +274,7 @@ void CefFileDialogManager::RunFileChooserInternal(
if (params.hidereadonly)
mode |= FILE_DIALOG_HIDEREADONLY_FLAG;
std::vector<base::string16>::const_iterator it;
std::vector<std::u16string>::const_iterator it;
std::vector<CefString> accept_filters;
it = params.accept_types.begin();
@ -357,7 +357,7 @@ void CefFileDialogManager::OnRunFileChooserDelegateCallback(
// Convert FilePath list to SelectedFileInfo list.
for (size_t i = 0; i < file_paths.size(); ++i) {
auto info = blink::mojom::FileChooserFileInfo::NewNativeFile(
blink::mojom::NativeFileInfo::New(file_paths[i], base::string16()));
blink::mojom::NativeFileInfo::New(file_paths[i], std::u16string()));
selected_files.push_back(std::move(info));
}
}

View File

@ -52,7 +52,7 @@ class CefJSDialogCallbackImpl : public CefJSDialogCallback {
private:
static void CancelNow(CallbackType callback) {
CEF_REQUIRE_UIT();
std::move(callback).Run(false, base::string16());
std::move(callback).Run(false, std::u16string());
}
CallbackType callback_;
@ -82,8 +82,8 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host,
content::JavaScriptDialogType message_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
DialogClosedCallback callback,
bool* did_suppress_message) {
const GURL& origin_url = render_frame_host->GetLastCommittedURL();
@ -128,7 +128,7 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
dialog_running_ = true;
const base::string16& display_url =
const std::u16string& display_url =
url_formatter::FormatUrlForSecurityDisplay(origin_url);
DCHECK(!callback.is_null());
@ -147,12 +147,11 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
AlloyBrowserHostImpl::DESTRUCTION_STATE_ACCEPTED) {
// Currently destroying the browser. Accept the unload without showing
// the prompt.
std::move(callback).Run(true, base::string16());
std::move(callback).Run(true, std::u16string());
return;
}
const base::string16& message_text =
base::ASCIIToUTF16("Is it OK to leave/reload this page?");
const std::u16string& message_text = u"Is it OK to leave/reload this page?";
CefRefPtr<CefClient> client = browser_->GetClient();
if (client.get()) {
@ -179,7 +178,7 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
LOG(WARNING) << "No javascript dialog runner available for this platform";
// Suppress the dialog if there is no platform runner or if the dialog is
// currently running.
std::move(callback).Run(true, base::string16());
std::move(callback).Run(true, std::u16string());
return;
}
@ -188,9 +187,9 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
DCHECK(!callback.is_null());
runner_->Run(
browser_, content::JAVASCRIPT_DIALOG_TYPE_CONFIRM,
base::string16(), // display_url
std::u16string(), // display_url
message_text,
base::string16(), // default_prompt_text
std::u16string(), // default_prompt_text
base::BindOnce(&CefJavaScriptDialogManager::DialogClosed,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
}
@ -216,7 +215,7 @@ void CefJavaScriptDialogManager::CancelDialogs(
void CefJavaScriptDialogManager::DialogClosed(
DialogClosedCallback callback,
bool success,
const base::string16& user_input) {
const std::u16string& user_input) {
CefRefPtr<CefClient> client = browser_->GetClient();
if (client.get()) {
CefRefPtr<CefJSDialogHandler> handler = client->GetJSDialogHandler();

View File

@ -31,8 +31,8 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
void RunJavaScriptDialog(content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host,
content::JavaScriptDialogType message_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
DialogClosedCallback callback,
bool* did_suppress_message) override;
void RunBeforeUnloadDialog(content::WebContents* web_contents,
@ -46,7 +46,7 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
// Method executed by the callback passed to CefJavaScriptDialogRunner::Run.
void DialogClosed(DialogClosedCallback callback,
bool success,
const base::string16& user_input);
const std::u16string& user_input);
// AlloyBrowserHostImpl pointer is guaranteed to outlive this object.
AlloyBrowserHostImpl* browser_;

View File

@ -8,7 +8,6 @@
#pragma once
#include "base/callback.h"
#include "base/strings/string16.h"
#include "content/public/common/javascript_dialog_type.h"
class AlloyBrowserHostImpl;
@ -16,15 +15,15 @@ class AlloyBrowserHostImpl;
class CefJavaScriptDialogRunner {
public:
typedef base::OnceCallback<void(bool /* success */,
const base::string16& /* user_input */)>
const std::u16string& /* user_input */)>
DialogClosedCallback;
// Run the dialog. Execute |callback| on completion.
virtual void Run(AlloyBrowserHostImpl* browser,
content::JavaScriptDialogType message_type,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& display_url,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
DialogClosedCallback callback) = 0;
// Cancel a dialog mid-flight.

View File

@ -99,7 +99,7 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
storage.reserve(argv.size());
for (size_t i = 0; i < argv.size(); ++i) {
#if defined(OS_WIN)
storage.push_back(base::UTF16ToUTF8(argv[i]));
storage.push_back(base::WideToUTF8(argv[i]));
#else
storage.push_back(argv[i]);
#endif

View File

@ -19,11 +19,12 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
namespace {
CefString GetLabel(int message_id) {
base::string16 label =
std::u16string label =
CefAppManager::Get()->GetContentClient()->GetLocalizedString(message_id);
DCHECK(!label.empty());
return label;
@ -267,7 +268,7 @@ void CefMenuManager::MenuClosed(CefRefPtr<CefMenuModelImpl> source) {
}
bool CefMenuManager::FormatLabel(CefRefPtr<CefMenuModelImpl> source,
base::string16& label) {
std::u16string& label) {
if (!runner_)
return false;
return runner_->FormatLabel(label);

View File

@ -47,7 +47,7 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
void MenuWillShow(CefRefPtr<CefMenuModelImpl> source) override;
void MenuClosed(CefRefPtr<CefMenuModelImpl> source) override;
bool FormatLabel(CefRefPtr<CefMenuModelImpl> source,
base::string16& label) override;
std::u16string& label) override;
void ExecuteCommandCallback(int command_id, cef_event_flags_t event_flags);

View File

@ -64,7 +64,7 @@ class CefSimpleMenuModel : public ui::MenuModel {
return impl_->GetCommandIdAt(index);
}
base::string16 GetLabelAt(int index) const override {
std::u16string GetLabelAt(int index) const override {
return impl_->GetFormattedLabelAt(index);
}
@ -886,8 +886,8 @@ void CefMenuModelImpl::MenuWillClose() {
FROM_HERE, base::Bind(&CefMenuModelImpl::OnMenuClosed, this));
}
base::string16 CefMenuModelImpl::GetFormattedLabelAt(int index) {
base::string16 label = GetLabelAt(index).ToString16();
std::u16string CefMenuModelImpl::GetFormattedLabelAt(int index) {
std::u16string label = GetLabelAt(index).ToString16();
if (delegate_)
delegate_->FormatLabel(this, label);
if (menu_model_delegate_) {

View File

@ -47,7 +47,7 @@ class CefMenuModelImpl : public CefMenuModel {
// Allows the delegate to modify a menu item label before it's displayed.
virtual bool FormatLabel(CefRefPtr<CefMenuModelImpl> source,
base::string16& label) = 0;
std::u16string& label) = 0;
protected:
virtual ~Delegate() {}
@ -166,7 +166,7 @@ class CefMenuModelImpl : public CefMenuModel {
SkColor* override_color) const;
void MenuWillShow();
void MenuWillClose();
base::string16 GetFormattedLabelAt(int index);
std::u16string GetFormattedLabelAt(int index);
const gfx::FontList* GetLabelFontListAt(int index) const;
// Verify that only a single reference exists to all CefMenuModelImpl objects.

View File

@ -6,9 +6,9 @@
#define CEF_LIBCEF_BROWSER_MENU_RUNNER_H_
#include <memory>
#include <string>
#include "base/macros.h"
#include "base/strings/string16.h"
namespace content {
struct ContextMenuParams;
@ -24,7 +24,7 @@ class CefMenuRunner {
CefMenuModelImpl* model,
const content::ContextMenuParams& params) = 0;
virtual void CancelContextMenu() {}
virtual bool FormatLabel(base::string16& label) { return false; }
virtual bool FormatLabel(std::u16string& label) { return false; }
protected:
// Allow deletion via scoped_ptr only.

View File

@ -295,7 +295,7 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent(
ui::KeycodeConverter::NativeKeycodeToDomCode(key_event.native_key_code);
int keysym = ui::XKeysymForWindowsKeyCode(
key_code, !!(key_event.modifiers & EVENTFLAG_SHIFT_DOWN));
base::char16 character = ui::GetUnicodeCharacterFromXKeySym(keysym);
char16_t character = ui::GetUnicodeCharacterFromXKeySym(keysym);
base::TimeTicks time_stamp = GetEventTimeStamp();
if (key_event.type == KEYEVENT_CHAR) {

View File

@ -69,7 +69,7 @@ const int kMaxAddressLengthChars = 2048;
bool HasExternalHandler(const std::string& scheme) {
base::win::RegKey key;
const std::wstring registry_path =
base::ASCIIToUTF16(scheme + "\\shell\\open\\command");
base::ASCIIToWide(scheme + "\\shell\\open\\command");
key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ);
if (key.Valid()) {
DWORD size = 0;

View File

@ -15,7 +15,7 @@ namespace cursor_util {
cef_cursor_handle_t GetPlatformCursor(ui::mojom::CursorType type) {
auto cursor = ui::CursorFactory::GetInstance()->GetDefaultCursor(type);
if (cursor) {
return ToCursorHandle(*cursor);
return ToCursorHandle(cursor);
}
return 0;
}

View File

@ -47,12 +47,16 @@ LPCWSTR ToCursorID(ui::mojom::CursorType type) {
return IDC_SIZENESW;
case ui::mojom::CursorType::kWestResize:
return IDC_SIZEWE;
case ui::mojom::CursorType::kNorthSouthNoResize:
case ui::mojom::CursorType::kNorthSouthResize:
return IDC_SIZENS;
case ui::mojom::CursorType::kEastWestNoResize:
case ui::mojom::CursorType::kEastWestResize:
return IDC_SIZEWE;
case ui::mojom::CursorType::kNorthEastSouthWestNoResize:
case ui::mojom::CursorType::kNorthEastSouthWestResize:
return IDC_SIZENESW;
case ui::mojom::CursorType::kNorthWestSouthEastNoResize:
case ui::mojom::CursorType::kNorthWestSouthEastResize:
return IDC_SIZENWSE;
case ui::mojom::CursorType::kColumnResize:

View File

@ -25,7 +25,7 @@
namespace {
base::string16 GetDescriptionFromMimeType(const std::string& mime_type) {
std::u16string GetDescriptionFromMimeType(const std::string& mime_type) {
// Check for wild card mime types and return an appropriate description.
static const struct {
const char* mime_type;
@ -42,31 +42,31 @@ base::string16 GetDescriptionFromMimeType(const std::string& mime_type) {
return l10n_util::GetStringUTF16(kWildCardMimeTypes[i].string_id);
}
return base::string16();
return std::u16string();
}
void AddFilters(NSPopUpButton* button,
const std::vector<base::string16>& accept_filters,
const std::vector<std::u16string>& accept_filters,
bool include_all_files,
std::vector<std::vector<base::string16>>* all_extensions) {
std::vector<std::vector<std::u16string>>* all_extensions) {
for (size_t i = 0; i < accept_filters.size(); ++i) {
const base::string16& filter = accept_filters[i];
const std::u16string& filter = accept_filters[i];
if (filter.empty())
continue;
std::vector<base::string16> extensions;
base::string16 description;
std::vector<std::u16string> extensions;
std::u16string description;
size_t sep_index = filter.find('|');
if (sep_index != std::string::npos) {
// Treat as a filter of the form "Filter Name|.ext1;.ext2;.ext3".
description = filter.substr(0, sep_index);
const std::vector<base::string16>& ext = base::SplitString(
filter.substr(sep_index + 1), base::ASCIIToUTF16(";"),
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
const std::vector<std::u16string>& ext =
base::SplitString(filter.substr(sep_index + 1), u";",
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (size_t x = 0; x < ext.size(); ++x) {
const base::string16& file_ext = ext[x];
const std::u16string& file_ext = ext[x];
if (!file_ext.empty() && file_ext[0] == '.')
extensions.push_back(file_ext);
}
@ -80,7 +80,7 @@ void AddFilters(NSPopUpButton* button,
net::GetExtensionsForMimeType(ascii, &ext);
if (!ext.empty()) {
for (size_t x = 0; x < ext.size(); ++x)
extensions.push_back(base::ASCIIToUTF16("." + ext[x]));
extensions.push_back(u"." + base::ASCIIToUTF16(ext[x]));
description = GetDescriptionFromMimeType(ascii);
}
}
@ -92,22 +92,21 @@ void AddFilters(NSPopUpButton* button,
// will keep growing.
const size_t kMaxExtensions = 10;
base::string16 ext_str;
std::u16string ext_str;
for (size_t x = 0; x < std::min(kMaxExtensions, extensions.size()); ++x) {
const base::string16& pattern = base::ASCIIToUTF16("*") + extensions[x];
const std::u16string& pattern = u"*" + extensions[x];
if (x != 0)
ext_str += base::ASCIIToUTF16(";");
ext_str += u";";
ext_str += pattern;
}
if (extensions.size() > kMaxExtensions)
ext_str += base::ASCIIToUTF16(";...");
ext_str += u";...";
if (description.empty()) {
description = ext_str;
} else {
description +=
base::ASCIIToUTF16(" (") + ext_str + base::ASCIIToUTF16(")");
description += u" (" + ext_str + u")";
}
[button addItemWithTitle:base::SysUTF16ToNSString(description)];
@ -119,7 +118,7 @@ void AddFilters(NSPopUpButton* button,
// is implied).
if (include_all_files && !all_extensions->empty()) {
[button addItemWithTitle:base::SysUTF8ToNSString("All Files (*)")];
all_extensions->push_back(std::vector<base::string16>());
all_extensions->push_back(std::vector<std::u16string>());
}
}
@ -129,11 +128,11 @@ void AddFilters(NSPopUpButton* button,
@interface CefFilterDelegate : NSObject {
@private
NSSavePanel* panel_;
std::vector<std::vector<base::string16>> extensions_;
std::vector<std::vector<std::u16string>> extensions_;
int selected_index_;
}
- (id)initWithPanel:(NSSavePanel*)panel
andAcceptFilters:(const std::vector<base::string16>&)accept_filters
andAcceptFilters:(const std::vector<std::u16string>&)accept_filters
andFilterIndex:(int)index;
- (void)setFilter:(int)index;
- (int)filter;
@ -144,7 +143,7 @@ void AddFilters(NSPopUpButton* button,
@implementation CefFilterDelegate
- (id)initWithPanel:(NSSavePanel*)panel
andAcceptFilters:(const std::vector<base::string16>&)accept_filters
andAcceptFilters:(const std::vector<std::u16string>&)accept_filters
andFilterIndex:(int)index {
if (self = [super init]) {
DCHECK(panel);
@ -204,7 +203,7 @@ void AddFilters(NSPopUpButton* button,
// Set the extension on the currently selected file name.
- (void)setFileExtension {
const std::vector<base::string16>& filter = extensions_[selected_index_];
const std::vector<std::u16string>& filter = extensions_[selected_index_];
if (filter.empty()) {
// All extensions are allowed so don't change anything.
return;
@ -214,7 +213,7 @@ void AddFilters(NSPopUpButton* button,
// If the file name currently includes an extension from |filter| then don't
// change anything.
base::string16 extension = base::UTF8ToUTF16(path.Extension());
std::u16string extension = base::UTF8ToUTF16(path.Extension());
if (!extension.empty()) {
for (size_t i = 0; i < filter.size(); ++i) {
if (filter[i] == extension)
@ -259,7 +258,7 @@ void CefFileDialogRunnerMac::RunOpenFileDialog(
int filter_index) {
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
base::string16 title;
std::u16string title;
if (!params.title.empty()) {
title = params.title;
} else {
@ -347,7 +346,7 @@ void CefFileDialogRunnerMac::RunSaveFileDialog(
int filter_index) {
NSSavePanel* savePanel = [NSSavePanel savePanel];
base::string16 title;
std::u16string title;
if (!params.title.empty())
title = params.title;
else

View File

@ -69,8 +69,8 @@ std::wstring FormatFilterForExtensions(
bool include_all_files) {
const std::wstring all_ext = L"*.*";
const std::wstring all_desc =
l10n_util::GetStringUTF16(IDS_APP_SAVEAS_ALL_FILES) + L" (" + all_ext +
L")";
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_SAVEAS_ALL_FILES)) +
L" (" + all_ext + L")";
DCHECK(file_ext.size() >= ext_desc.size());
@ -97,7 +97,8 @@ std::wstring FormatFilterForExtensions(
ext += L";" + std::wstring(*it);
}
std::wstring desc =
l10n_util::GetStringUTF16(IDS_CUSTOM_FILES) + L" (" + ext + L")";
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_CUSTOM_FILES)) +
L" (" + ext + L")";
result.append(desc.c_str(), desc.size() + 1); // Append NULL too.
result.append(ext.c_str(), ext.size() + 1);
@ -167,34 +168,36 @@ std::wstring GetDescriptionFromMimeType(const std::string& mime_type) {
};
for (size_t i = 0; i < base::size(kWildCardMimeTypes); ++i) {
if (mime_type == std::string(kWildCardMimeTypes[i].mime_type) + "/*")
return l10n_util::GetStringUTF16(kWildCardMimeTypes[i].string_id);
if (mime_type == std::string(kWildCardMimeTypes[i].mime_type) + "/*") {
return base::UTF16ToWide(
l10n_util::GetStringUTF16(kWildCardMimeTypes[i].string_id));
}
}
return std::wstring();
}
std::wstring GetFilterString(
const std::vector<base::string16>& accept_filters) {
const std::vector<std::u16string>& accept_filters) {
std::vector<std::wstring> extensions;
std::vector<std::wstring> descriptions;
for (size_t i = 0; i < accept_filters.size(); ++i) {
const base::string16& filter = accept_filters[i];
const std::wstring& filter = base::UTF16ToWide(accept_filters[i]);
if (filter.empty())
continue;
size_t sep_index = filter.find('|');
if (sep_index != base::string16::npos) {
size_t sep_index = filter.find(L'|');
if (sep_index != std::wstring::npos) {
// Treat as a filter of the form "Filter Name|.ext1;.ext2;.ext3".
const base::string16& desc = filter.substr(0, sep_index);
const std::vector<base::string16>& ext = base::SplitString(
filter.substr(sep_index + 1), base::ASCIIToUTF16(";"),
const std::wstring& desc = filter.substr(0, sep_index);
const std::vector<std::u16string>& ext = base::SplitString(
base::WideToUTF16(filter.substr(sep_index + 1)), u";",
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
std::wstring ext_str;
for (size_t x = 0; x < ext.size(); ++x) {
const base::string16& file_ext = ext[x];
if (!file_ext.empty() && file_ext[0] == '.') {
const std::wstring& file_ext = base::UTF16ToWide(ext[x]);
if (!file_ext.empty() && file_ext[0] == L'.') {
if (!ext_str.empty())
ext_str += L";";
ext_str += L"*" + file_ext;
@ -210,7 +213,7 @@ std::wstring GetFilterString(
descriptions.push_back(std::wstring());
} else {
// Otherwise convert mime type to one or more extensions.
const std::string& ascii = base::UTF16ToASCII(filter);
const std::string& ascii = base::WideToASCII(filter);
std::vector<base::FilePath::StringType> ext;
std::wstring ext_str;
net::GetExtensionsForMimeType(ascii, &ext);
@ -264,10 +267,12 @@ bool RunOpenFileDialog(const CefFileDialogRunner::FileChooserParams& params,
ofn.lpstrInitialDir = directory.c_str();
std::wstring title;
if (!params.title.empty())
title = params.title;
else
title = l10n_util::GetStringUTF16(IDS_OPEN_FILE_DIALOG_TITLE);
if (!params.title.empty()) {
title = base::UTF16ToWide(params.title);
} else {
title = base::UTF16ToWide(
l10n_util::GetStringUTF16(IDS_OPEN_FILE_DIALOG_TITLE));
}
if (!title.empty())
ofn.lpstrTitle = title.c_str();
@ -326,10 +331,12 @@ bool RunOpenMultiFileDialog(
ofn.lpstrInitialDir = directory.c_str();
std::wstring title;
if (!params.title.empty())
title = params.title;
else
title = l10n_util::GetStringUTF16(IDS_OPEN_FILES_DIALOG_TITLE);
if (!params.title.empty()) {
title = base::UTF16ToWide(params.title);
} else {
title = base::UTF16ToWide(
l10n_util::GetStringUTF16(IDS_OPEN_FILES_DIALOG_TITLE));
}
if (!title.empty())
ofn.lpstrTitle = title.c_str();
@ -404,10 +411,12 @@ bool RunOpenFolderDialog(const CefFileDialogRunner::FileChooserParams& params,
browse_info.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
std::wstring title;
if (!params.title.empty())
title = params.title;
else
title = l10n_util::GetStringUTF16(IDS_SELECT_FOLDER_DIALOG_TITLE);
if (!params.title.empty()) {
title = base::UTF16ToWide(params.title);
} else {
title = base::UTF16ToWide(
l10n_util::GetStringUTF16(IDS_SELECT_FOLDER_DIALOG_TITLE));
}
if (!title.empty())
browse_info.lpszTitle = title.c_str();
@ -479,10 +488,12 @@ bool RunSaveFileDialog(const CefFileDialogRunner::FileChooserParams& params,
ofn.lpstrInitialDir = directory.c_str();
std::wstring title;
if (!params.title.empty())
title = params.title;
else
title = l10n_util::GetStringUTF16(IDS_SAVE_AS_DIALOG_TITLE);
if (!params.title.empty()) {
title = base::UTF16ToWide(params.title);
} else {
title =
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_SAVE_AS_DIALOG_TITLE));
}
if (!title.empty())
ofn.lpstrTitle = title.c_str();

View File

@ -26,14 +26,14 @@ class CefJavaScriptDialogRunnerMac : public CefJavaScriptDialogRunner {
// CefJavaScriptDialogRunner methods:
void Run(AlloyBrowserHostImpl* browser,
content::JavaScriptDialogType message_type,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& display_url,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
DialogClosedCallback callback) override;
void Cancel() override;
// Callback from CefJavaScriptDialogHelper when the dialog is closed.
void DialogClosed(bool success, const base::string16& user_input);
void DialogClosed(bool success, const std::u16string& user_input);
private:
DialogClosedCallback callback_;

View File

@ -65,7 +65,7 @@
return;
bool success = returnCode == NSAlertFirstButtonReturn;
base::string16 input;
std::u16string input;
if (textField_)
input = base::SysNSStringToUTF16([textField_ stringValue]);
@ -89,9 +89,9 @@ CefJavaScriptDialogRunnerMac::~CefJavaScriptDialogRunnerMac() {
void CefJavaScriptDialogRunnerMac::Run(
AlloyBrowserHostImpl* browser,
content::JavaScriptDialogType message_type,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& display_url,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
DialogClosedCallback callback) {
DCHECK(!helper_.get());
callback_ = std::move(callback);
@ -114,20 +114,20 @@ void CefJavaScriptDialogRunnerMac::Run(
[alert setDelegate:helper_];
[alert setInformativeText:base::SysUTF16ToNSString(message_text)];
base::string16 label;
std::u16string label;
switch (message_type) {
case content::JAVASCRIPT_DIALOG_TYPE_ALERT:
label = base::ASCIIToUTF16("JavaScript Alert");
label = u"JavaScript Alert";
break;
case content::JAVASCRIPT_DIALOG_TYPE_PROMPT:
label = base::ASCIIToUTF16("JavaScript Prompt");
label = u"JavaScript Prompt";
break;
case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM:
label = base::ASCIIToUTF16("JavaScript Confirm");
label = u"JavaScript Confirm";
break;
}
if (!display_url.empty())
label += base::ASCIIToUTF16(" - ") + display_url;
label += u" - " + display_url;
[alert setMessageText:base::SysUTF16ToNSString(label)];
@ -165,7 +165,7 @@ void CefJavaScriptDialogRunnerMac::Cancel() {
void CefJavaScriptDialogRunnerMac::DialogClosed(
bool success,
const base::string16& user_input) {
const std::u16string& user_input) {
helper_.reset(nil);
std::move(callback_).Run(success, user_input);
}

View File

@ -39,7 +39,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(HWND dialog,
reinterpret_cast<CefJavaScriptDialogRunnerWin*>(
GetWindowLongPtr(dialog, DWLP_USER));
if (owner) {
owner->CloseDialog(false, base::string16());
owner->CloseDialog(false, std::wstring());
// No need for the system to call DestroyWindow() because it will be
// called by the Cancel() method.
@ -51,7 +51,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(HWND dialog,
CefJavaScriptDialogRunnerWin* owner =
reinterpret_cast<CefJavaScriptDialogRunnerWin*>(
GetWindowLongPtr(dialog, DWLP_USER));
base::string16 user_input;
std::wstring user_input;
bool finish = false;
bool result = false;
switch (LOWORD(wparam)) {
@ -62,8 +62,9 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(HWND dialog,
size_t length =
GetWindowTextLength(GetDlgItem(dialog, IDC_PROMPTEDIT)) + 1;
if (length > 1) {
GetDlgItemText(dialog, IDC_PROMPTEDIT,
base::WriteInto(&user_input, length), length);
user_input.reserve(length);
user_input.resize(length - 1);
GetDlgItemText(dialog, IDC_PROMPTEDIT, &user_input[0], length);
}
}
break;
@ -93,15 +94,15 @@ CefJavaScriptDialogRunnerWin::~CefJavaScriptDialogRunnerWin() {
void CefJavaScriptDialogRunnerWin::Run(
AlloyBrowserHostImpl* browser,
content::JavaScriptDialogType message_type,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& display_url,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
DialogClosedCallback callback) {
DCHECK(!dialog_win_);
message_type_ = message_type;
message_text_ = message_text;
default_prompt_text_ = default_prompt_text;
message_text_ = base::UTF16ToWide(message_text);
default_prompt_text_ = base::UTF16ToWide(default_prompt_text);
callback_ = std::move(callback);
InstallMessageHook();
@ -135,11 +136,11 @@ void CefJavaScriptDialogRunnerWin::Run(
if (!display_url.empty()) {
// Add the display URL to the window title.
TCHAR text[64];
GetWindowText(dialog_win_, text, sizeof(text) / sizeof(TCHAR));
wchar_t text[64];
GetWindowText(dialog_win_, text, sizeof(text) / sizeof(wchar_t));
base::string16 new_window_text =
text + base::ASCIIToUTF16(" - ") + display_url;
std::wstring new_window_text =
std::wstring(text) + L" - " + base::UTF16ToWide(display_url);
SetWindowText(dialog_win_, new_window_text.c_str());
}
@ -170,14 +171,13 @@ void CefJavaScriptDialogRunnerWin::Cancel() {
}
}
void CefJavaScriptDialogRunnerWin::CloseDialog(
bool success,
const base::string16& user_input) {
void CefJavaScriptDialogRunnerWin::CloseDialog(bool success,
const std::wstring& user_input) {
// Run the callback first so that RenderProcessHostImpl::IsBlocked is
// cleared. Otherwise, RenderWidgetHostImpl::IsIgnoringInputEvents will
// return true and RenderWidgetHostViewAura::OnWindowFocused will fail to
// re-assign browser focus.
std::move(callback_).Run(success, user_input);
std::move(callback_).Run(success, base::WideToUTF16(user_input));
Cancel();
}

View File

@ -19,21 +19,21 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner {
// CefJavaScriptDialogRunner methods:
void Run(AlloyBrowserHostImpl* browser,
content::JavaScriptDialogType message_type,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& display_url,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
DialogClosedCallback callback) override;
void Cancel() override;
private:
void CloseDialog(bool success, const base::string16& user_input);
void CloseDialog(bool success, const std::wstring& user_input);
HWND dialog_win_;
HWND parent_win_;
content::JavaScriptDialogType message_type_;
base::string16 message_text_;
base::string16 default_prompt_text_;
std::wstring message_text_;
std::wstring default_prompt_text_;
DialogClosedCallback callback_;
bool hook_installed_;

View File

@ -37,8 +37,8 @@ void CefMenuRunnerLinux::CancelContextMenu() {
menu_->Cancel();
}
bool CefMenuRunnerLinux::FormatLabel(base::string16& label) {
bool CefMenuRunnerLinux::FormatLabel(std::u16string& label) {
// Remove the accelerator indicator (&) from label strings.
const base::string16::value_type replace[] = {L'&', 0};
return base::ReplaceChars(label, replace, base::string16(), &label);
const std::u16string::value_type replace[] = {u'&', 0};
return base::ReplaceChars(label, replace, std::u16string(), &label);
}

View File

@ -19,7 +19,7 @@ class CefMenuRunnerLinux : public CefMenuRunner {
CefMenuModelImpl* model,
const content::ContextMenuParams& params) override;
void CancelContextMenu() override;
bool FormatLabel(base::string16& label) override;
bool FormatLabel(std::u16string& label) override;
private:
std::unique_ptr<views::MenuRunner> menu_;

View File

@ -93,7 +93,7 @@ HFONT CreateNativeFont(const gfx::Font& font) {
italic, underline, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE,
base::UTF8ToUTF16(font.GetFontName()).c_str());
base::UTF8ToWide(font.GetFontName()).c_str());
}
} // namespace
@ -102,7 +102,7 @@ struct CefNativeMenuWin::ItemData {
// The Windows API requires that whoever creates the menus must own the
// strings used for labels, and keep them around for the lifetime of the
// created menu. So be it.
base::string16 label;
std::wstring label;
// Someone needs to own submenus, it may as well be us.
std::unique_ptr<Menu2> submenu;
@ -204,14 +204,14 @@ class CefNativeMenuWin::MenuHostWindow {
if (data) {
gfx::FontList font_list;
measure_item_struct->itemWidth =
gfx::GetStringWidth(data->label, font_list) + kIconWidth +
kItemLeftMargin + kItemLabelSpacing -
gfx::GetStringWidth(base::WideToUTF16(data->label), font_list) +
kIconWidth + kItemLeftMargin + kItemLabelSpacing -
GetSystemMetrics(SM_CXMENUCHECK);
if (data->submenu.get())
measure_item_struct->itemWidth += kArrowWidth;
// If the label contains an accelerator, make room for tab.
if (data->label.find(L'\t') != base::string16::npos)
measure_item_struct->itemWidth += gfx::GetStringWidth(L" ", font_list);
if (data->label.find(L'\t') != std::wstring::npos)
measure_item_struct->itemWidth += gfx::GetStringWidth(u" ", font_list);
measure_item_struct->itemHeight =
font_list.GetHeight() + kItemBottomMargin + kItemTopMargin;
} else {
@ -267,10 +267,10 @@ class CefNativeMenuWin::MenuHostWindow {
// left and the accelerator on the right.
// TODO(jungshik): This will break in RTL UI. Currently, he/ar use the
// window system UI font and will not hit here.
base::string16 label = data->label;
base::string16 accel;
base::string16::size_type tab_pos = label.find(L'\t');
if (tab_pos != base::string16::npos) {
std::wstring label = data->label;
std::wstring accel;
std::wstring::size_type tab_pos = label.find(L'\t');
if (tab_pos != std::wstring::npos) {
accel = label.substr(tab_pos);
label = label.substr(0, tab_pos);
}
@ -527,7 +527,7 @@ void CefNativeMenuWin::UpdateStates() {
if (model_->IsItemDynamicAt(model_index)) {
// TODO(atwilson): Update the icon as well (http://crbug.com/66508).
SetMenuItemLabel(menu_index, model_index,
model_->GetLabelAt(model_index));
base::UTF16ToWide(model_->GetLabelAt(model_index)));
}
Menu2* submenu = (*it)->submenu.get();
if (submenu)
@ -643,7 +643,7 @@ void CefNativeMenuWin::AddMenuItemAt(int menu_index, int model_index) {
mii.fType = MFT_OWNERDRAW;
std::unique_ptr<ItemData> item_data = std::make_unique<ItemData>();
item_data->label = base::string16();
item_data->label = std::wstring();
ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
if (type == ui::MenuModel::TYPE_SUBMENU) {
item_data->submenu.reset(new Menu2(model_->GetSubmenuModelAt(model_index)));
@ -659,8 +659,8 @@ void CefNativeMenuWin::AddMenuItemAt(int menu_index, int model_index) {
item_data->model_index = model_index;
mii.dwItemData = reinterpret_cast<ULONG_PTR>(item_data.get());
items_.insert(items_.begin() + model_index, std::move(item_data));
UpdateMenuItemInfoForString(&mii, model_index,
model_->GetLabelAt(model_index));
UpdateMenuItemInfoForString(
&mii, model_index, base::UTF16ToWide(model_->GetLabelAt(model_index)));
InsertMenuItem(menu_, menu_index, TRUE, &mii);
}
@ -697,7 +697,7 @@ void CefNativeMenuWin::SetMenuItemState(int menu_index,
void CefNativeMenuWin::SetMenuItemLabel(int menu_index,
int model_index,
const base::string16& label) {
const std::wstring& label) {
if (IsSeparatorItemAt(menu_index))
return;
@ -707,11 +707,10 @@ void CefNativeMenuWin::SetMenuItemLabel(int menu_index,
SetMenuItemInfo(menu_, menu_index, MF_BYPOSITION, &mii);
}
void CefNativeMenuWin::UpdateMenuItemInfoForString(
MENUITEMINFO* mii,
int model_index,
const base::string16& label) {
base::string16 formatted = label;
void CefNativeMenuWin::UpdateMenuItemInfoForString(MENUITEMINFO* mii,
int model_index,
const std::wstring& label) {
std::wstring formatted = label;
ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
// Strip out any tabs, otherwise they get interpreted as accelerators and can
// lead to weird behavior.
@ -721,7 +720,7 @@ void CefNativeMenuWin::UpdateMenuItemInfoForString(
ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE);
if (model_->GetAcceleratorAt(model_index, &accelerator)) {
formatted += L"\t";
formatted += accelerator.GetShortcutText();
formatted += base::UTF16ToWide(accelerator.GetShortcutText());
}
}

View File

@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
namespace ui {
class MenuModel;
@ -73,7 +72,7 @@ class CefNativeMenuWin : public MenuWrapper {
// Sets the label of the item at the specified index.
void SetMenuItemLabel(int menu_index,
int model_index,
const base::string16& label);
const std::wstring& label);
// Updates the local data structure with the correctly formatted version of
// |label| at the specified model_index, and adds string data to |mii| if
@ -81,7 +80,7 @@ class CefNativeMenuWin : public MenuWrapper {
// of the peculiarities of the Windows menu API.
void UpdateMenuItemInfoForString(MENUITEMINFO* mii,
int model_index,
const base::string16& label);
const std::wstring& label);
// Returns the alignment flags to be passed to TrackPopupMenuEx, based on the
// supplied alignment and the UI text direction.

View File

@ -23,7 +23,7 @@ namespace {
base::FilePath FilePathFromASCII(const std::string& str) {
#if defined(OS_WIN)
return base::FilePath(base::ASCIIToUTF16(str));
return base::FilePath(base::ASCIIToWide(str));
#else
return base::FilePath(str);
#endif

View File

@ -206,13 +206,12 @@ class CefBrowserURLRequest::Context
auto browser_context = cef_browser_context->AsBrowserContext();
CHECK(browser_context);
int render_frame_id = MSG_ROUTING_NONE;
scoped_refptr<net_service::URLLoaderFactoryGetter> loader_factory_getter;
// Used to route authentication and certificate callbacks through the
// associated StoragePartition instance.
mojo::PendingRemote<network::mojom::AuthenticationAndCertificateObserver>
auth_cert_observer;
mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver>
url_loader_network_observer;
if (frame) {
// The request will be associated with this frame/browser if it's valid,
@ -220,23 +219,16 @@ class CefBrowserURLRequest::Context
content::RenderFrameHost* rfh =
static_cast<CefFrameHostImpl*>(frame.get())->GetRenderFrameHost();
if (rfh) {
// In cases where authentication is required this value will be passed
// as the |routing_id| parameter to
// NetworkServiceClient::OnAuthRequired. Despite the naming the
// GetWebContents method in network_service_client.cc expects it to be a
// FrameTreeNodeId. The |process_id| parameter will always be
// network::mojom::kBrowserProcessId (value 0) for these requests.
render_frame_id = rfh->GetFrameTreeNodeId();
loader_factory_getter =
net_service::URLLoaderFactoryGetter::Create(rfh, browser_context);
auth_cert_observer = static_cast<content::RenderFrameHostImpl*>(rfh)
->CreateAuthAndCertObserver();
url_loader_network_observer =
static_cast<content::RenderFrameHostImpl*>(rfh)
->CreateURLLoaderNetworkObserver();
}
} else {
loader_factory_getter =
net_service::URLLoaderFactoryGetter::Create(nullptr, browser_context);
auth_cert_observer =
url_loader_network_observer =
static_cast<content::StoragePartitionImpl*>(
content::BrowserContext::GetDefaultStoragePartition(
browser_context))
@ -247,16 +239,15 @@ class CefBrowserURLRequest::Context
FROM_HERE,
base::BindOnce(
&CefBrowserURLRequest::Context::ContinueOnOriginatingThread, self,
render_frame_id, MakeRequestID(), loader_factory_getter,
std::move(auth_cert_observer)));
MakeRequestID(), loader_factory_getter,
std::move(url_loader_network_observer)));
}
void ContinueOnOriginatingThread(
int render_frame_id,
int32_t request_id,
scoped_refptr<net_service::URLLoaderFactoryGetter> loader_factory_getter,
mojo::PendingRemote<network::mojom::AuthenticationAndCertificateObserver>
auth_cert_observer) {
mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver>
url_loader_network_observer) {
DCHECK(CalledOnValidThread());
// The request may have been canceled.
@ -282,8 +273,6 @@ class CefBrowserURLRequest::Context
static_cast<CefRequestImpl*>(request_.get())
->Get(resource_request.get(), false);
resource_request->render_frame_id = render_frame_id;
// Behave the same as a subresource load.
resource_request->resource_type =
static_cast<int>(blink::mojom::ResourceType::kSubResource);
@ -298,11 +287,11 @@ class CefBrowserURLRequest::Context
net::SiteForCookies::FromOrigin(*resource_request->request_initiator);
}
if (auth_cert_observer) {
if (url_loader_network_observer) {
resource_request->trusted_params =
network::ResourceRequest::TrustedParams();
resource_request->trusted_params->auth_cert_observer =
std::move(auth_cert_observer);
resource_request->trusted_params->url_loader_network_observer =
std::move(url_loader_network_observer);
}
// SimpleURLLoader is picky about the body contents. Try to populate them

View File

@ -46,7 +46,7 @@ net::CookieOptions GetCookieOptions(const network::ResourceRequest& request) {
options.set_include_httponly();
options.set_same_site_cookie_context(
net::cookie_util::ComputeSameSiteContextForRequest(
request.method, request.url, request.site_for_cookies,
request.method, {request.url}, request.site_for_cookies,
request.request_initiator, is_main_frame_navigation,
should_treat_as_first_party));

View File

@ -180,7 +180,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
public:
InterceptedRequest(
ProxyURLLoaderFactory* factory,
RequestId id,
int32_t id,
uint32_t options,
const network::ResourceRequest& request,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
@ -207,6 +207,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
OnHeadersReceivedCallback callback) override;
// mojom::URLLoaderClient methods:
void OnReceiveEarlyHints(network::mojom::EarlyHintsPtr early_hints) override;
void OnReceiveResponse(network::mojom::URLResponseHeadPtr head) override;
void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
network::mojom::URLResponseHeadPtr head) override;
@ -230,7 +231,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
void PauseReadingBodyFromNet() override;
void ResumeReadingBodyFromNet() override;
const RequestId id() const { return id_; }
int32_t id() const { return id_; }
private:
// Helpers for determining the request handler.
@ -289,7 +290,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
void OnUploadProgressACK();
ProxyURLLoaderFactory* const factory_;
const RequestId id_;
const int32_t id_;
const uint32_t options_;
bool input_stream_previously_failed_ = false;
bool request_was_redirected_ = false;
@ -346,19 +347,18 @@ class InterceptDelegate : public StreamReaderURLLoader::Delegate {
base::WeakPtr<InterceptedRequest> request)
: response_(std::move(response)), request_(request) {}
bool OpenInputStream(const RequestId& request_id,
bool OpenInputStream(int32_t request_id,
const network::ResourceRequest& request,
OpenCallback callback) override {
return response_->OpenInputStream(request_id, request, std::move(callback));
}
void OnInputStreamOpenFailed(const RequestId& request_id,
bool* restarted) override {
void OnInputStreamOpenFailed(int32_t request_id, bool* restarted) override {
request_->InputStreamFailed(false /* restart_needed */);
*restarted = false;
}
void GetResponseHeaders(const RequestId& request_id,
void GetResponseHeaders(int32_t request_id,
int* status_code,
std::string* reason_phrase,
std::string* mime_type,
@ -377,7 +377,7 @@ class InterceptDelegate : public StreamReaderURLLoader::Delegate {
InterceptedRequest::InterceptedRequest(
ProxyURLLoaderFactory* factory,
RequestId id,
int32_t id,
uint32_t options,
const network::ResourceRequest& request,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
@ -533,6 +533,11 @@ void InterceptedRequest::OnHeadersReceived(
// URLLoaderClient methods.
void InterceptedRequest::OnReceiveEarlyHints(
network::mojom::EarlyHintsPtr early_hints) {
target_client_->OnReceiveEarlyHints(std::move(early_hints));
}
void InterceptedRequest::OnReceiveResponse(
network::mojom::URLResponseHeadPtr head) {
current_response_ = std::move(head);
@ -776,8 +781,7 @@ void InterceptedRequest::ContinueAfterIntercept() {
// might, so we need to set the option on the loader.
uint32_t options = options_ | network::mojom::kURLLoadOptionUseHeaderClient;
target_factory_->CreateLoaderAndStart(
target_loader_.BindNewPipeAndPassReceiver(), id_.routing_id(),
id_.request_id(), options, request_,
target_loader_.BindNewPipeAndPassReceiver(), id_, options, request_,
proxied_client_receiver_.BindNewPipeAndPassRemote(),
traffic_annotation_);
}
@ -1141,7 +1145,7 @@ InterceptedRequestHandler::InterceptedRequestHandler() {}
InterceptedRequestHandler::~InterceptedRequestHandler() {}
void InterceptedRequestHandler::OnBeforeRequest(
const RequestId& id,
int32_t request_id,
network::ResourceRequest* request,
bool request_was_redirected,
OnBeforeRequestResultCallback callback,
@ -1150,14 +1154,14 @@ void InterceptedRequestHandler::OnBeforeRequest(
}
void InterceptedRequestHandler::ShouldInterceptRequest(
const RequestId& id,
int32_t request_id,
network::ResourceRequest* request,
ShouldInterceptRequestResultCallback callback) {
std::move(callback).Run(nullptr);
}
void InterceptedRequestHandler::OnRequestResponse(
const RequestId& id,
int32_t request_id,
network::ResourceRequest* request,
net::HttpResponseHeaders* headers,
base::Optional<net::RedirectInfo> redirect_info,
@ -1169,7 +1173,7 @@ void InterceptedRequestHandler::OnRequestResponse(
mojo::ScopedDataPipeConsumerHandle
InterceptedRequestHandler::OnFilterResponseBody(
const RequestId& id,
int32_t request_id,
const network::ResourceRequest& request,
mojo::ScopedDataPipeConsumerHandle body) {
return body;
@ -1287,7 +1291,6 @@ void ProxyURLLoaderFactory::CreateProxy(
void ProxyURLLoaderFactory::CreateLoaderAndStart(
mojo::PendingReceiver<network::mojom::URLLoader> receiver,
int32_t routing_id,
int32_t request_id,
uint32_t options,
const network::ResourceRequest& request,
@ -1303,9 +1306,9 @@ void ProxyURLLoaderFactory::CreateLoaderAndStart(
if (pass_through) {
// This is the so-called pass-through, no-op option.
if (target_factory_) {
target_factory_->CreateLoaderAndStart(
std::move(receiver), routing_id, request_id, options, request,
std::move(client), traffic_annotation);
target_factory_->CreateLoaderAndStart(std::move(receiver), request_id,
options, request, std::move(client),
traffic_annotation);
}
return;
}
@ -1317,9 +1320,8 @@ void ProxyURLLoaderFactory::CreateLoaderAndStart(
}
InterceptedRequest* req = new InterceptedRequest(
this, RequestId(request_id, routing_id), options, request,
traffic_annotation, std::move(receiver), std::move(client),
std::move(target_factory_clone));
this, request_id, options, request, traffic_annotation,
std::move(receiver), std::move(client), std::move(target_factory_clone));
requests_.insert(std::make_pair(request_id, base::WrapUnique(req)));
req->Restart();
}
@ -1362,7 +1364,7 @@ void ProxyURLLoaderFactory::OnProxyBindingError() {
}
void ProxyURLLoaderFactory::RemoveRequest(InterceptedRequest* request) {
auto it = requests_.find(request->id().request_id());
auto it = requests_.find(request->id());
DCHECK(it != requests_.end());
requests_.erase(it);

View File

@ -46,7 +46,7 @@ class InterceptedRequestHandler {
base::OnceCallback<void(bool /* intercept_request */,
bool /* intercept_only */)>;
using CancelRequestCallback = base::OnceCallback<void(int /* error_code */)>;
virtual void OnBeforeRequest(const RequestId& id,
virtual void OnBeforeRequest(int32_t request_id,
network::ResourceRequest* request,
bool request_was_redirected,
OnBeforeRequestResultCallback callback,
@ -57,7 +57,7 @@ class InterceptedRequestHandler {
using ShouldInterceptRequestResultCallback =
base::OnceCallback<void(std::unique_ptr<ResourceResponse>)>;
virtual void ShouldInterceptRequest(
const RequestId& id,
int32_t request_id,
network::ResourceRequest* request,
ShouldInterceptRequestResultCallback callback);
@ -68,7 +68,7 @@ class InterceptedRequestHandler {
// values will be merged first, and then any |removed_headers| values will be
// removed. This comparison is case sensitive.
virtual void ProcessRequestHeaders(
const RequestId& id,
int32_t request_id,
const network::ResourceRequest& request,
const GURL& redirect_url,
net::HttpRequestHeaders* modified_headers,
@ -79,7 +79,7 @@ class InterceptedRequestHandler {
// method is called in response to a redirect. Even though |head| is const the
// |head.headers| value is non-const and any changes will be passed to the
// client.
virtual void ProcessResponseHeaders(const RequestId& id,
virtual void ProcessResponseHeaders(int32_t request_id,
const network::ResourceRequest& request,
const GURL& redirect_url,
net::HttpResponseHeaders* headers) {}
@ -101,7 +101,7 @@ class InterceptedRequestHandler {
scoped_refptr<net::HttpResponseHeaders> /* override_headers */,
const GURL& /* redirect_url */)>;
virtual void OnRequestResponse(
const RequestId& id,
int32_t request_id,
network::ResourceRequest* request,
net::HttpResponseHeaders* headers,
base::Optional<net::RedirectInfo> redirect_info,
@ -109,18 +109,18 @@ class InterceptedRequestHandler {
// Called to optionally filter the response body.
virtual mojo::ScopedDataPipeConsumerHandle OnFilterResponseBody(
const RequestId& id,
int32_t request_id,
const network::ResourceRequest& request,
mojo::ScopedDataPipeConsumerHandle body);
// Called on completion notification from the loader (successful or not).
virtual void OnRequestComplete(
const RequestId& id,
int32_t request_id,
const network::ResourceRequest& request,
const network::URLLoaderCompletionStatus& status) {}
// Called on error.
virtual void OnRequestError(const RequestId& id,
virtual void OnRequestError(int32_t request_id,
const network::ResourceRequest& request,
int error_code,
bool safebrowsing_hit) {}
@ -156,7 +156,6 @@ class ProxyURLLoaderFactory
// mojom::URLLoaderFactory methods:
void CreateLoaderAndStart(
mojo::PendingReceiver<network::mojom::URLLoader> receiver,
int32_t routing_id,
int32_t request_id,
uint32_t options,
const network::ResourceRequest& request,

View File

@ -372,7 +372,7 @@ void CallProcessRequestOnIOThread(
class ResourceResponseWrapper : public ResourceResponse {
public:
ResourceResponseWrapper(const RequestId request_id,
ResourceResponseWrapper(const int32_t request_id,
CefRefPtr<CefResourceHandler> handler)
: request_id_(request_id),
handler_provider_(new HandlerProvider(handler)) {}
@ -383,7 +383,7 @@ class ResourceResponseWrapper : public ResourceResponse {
}
// ResourceResponse methods:
bool OpenInputStream(const RequestId& request_id,
bool OpenInputStream(int32_t request_id,
const network::ResourceRequest& request,
OpenCallback callback) override {
DCHECK_EQ(request_id, request_id_);
@ -396,7 +396,7 @@ class ResourceResponseWrapper : public ResourceResponse {
// May be recreated on redirect.
request_ = new CefRequestImpl();
request_->Set(&request, request_id.hash());
request_->Set(&request, request_id);
request_->SetReadOnly(true);
CefRefPtr<OpenCallbackWrapper> callbackWrapper = new OpenCallbackWrapper(
@ -426,7 +426,7 @@ class ResourceResponseWrapper : public ResourceResponse {
return true;
}
void GetResponseHeaders(const RequestId& request_id,
void GetResponseHeaders(int32_t request_id,
int* status_code,
std::string* reason_phrase,
std::string* mime_type,
@ -487,7 +487,7 @@ class ResourceResponseWrapper : public ResourceResponse {
}
private:
const RequestId request_id_;
const int32_t request_id_;
CefRefPtr<CefRequestImpl> request_;
scoped_refptr<HandlerProvider> handler_provider_;
@ -498,7 +498,7 @@ class ResourceResponseWrapper : public ResourceResponse {
} // namespace
std::unique_ptr<ResourceResponse> CreateResourceResponse(
const RequestId& request_id,
int32_t request_id,
CefRefPtr<CefResourceHandler> handler) {
return std::make_unique<ResourceResponseWrapper>(request_id, handler);
}

View File

@ -10,14 +10,13 @@
namespace net_service {
class RequestId;
class ResourceResponse;
// Create a ResourceResponse that delegates to |handler|.
// The resulting object should be passed to
// InterceptedRequestHandler::ShouldInterceptRequestResultCallback.
std::unique_ptr<ResourceResponse> CreateResourceResponse(
const RequestId& request_id,
int32_t request_id,
CefRefPtr<CefResourceHandler> handler);
} // namespace net_service

View File

@ -131,12 +131,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
};
struct PendingRequest {
PendingRequest(const RequestId& id,
PendingRequest(int32_t request_id,
network::ResourceRequest* request,
bool request_was_redirected,
OnBeforeRequestResultCallback callback,
CancelRequestCallback cancel_callback)
: id_(id),
: id_(request_id),
request_(request),
request_was_redirected_(request_was_redirected),
callback_(std::move(callback)),
@ -153,7 +153,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
std::move(callback_), std::move(cancel_callback_));
}
const RequestId id_;
const int32_t id_;
network::ResourceRequest* const request_;
const bool request_was_redirected_;
OnBeforeRequestResultCallback callback_;
@ -251,7 +251,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
CefRefPtr<CefBrowserHostBase> browser,
CefRefPtr<CefFrame> frame,
int render_process_id,
int render_frame_id,
int frame_tree_node_id,
bool is_navigation,
bool is_download,
@ -280,7 +279,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
render_process_id_ = render_process_id;
render_frame_id_ = render_frame_id;
frame_tree_node_id_ = frame_tree_node_id;
is_navigation_ = is_navigation;
is_download_ = is_download;
@ -317,7 +315,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
scoped_refptr<CefIOThreadState> iothread_state_;
CefBrowserContext::CookieableSchemes cookieable_schemes_;
int render_process_id_ = 0;
int render_frame_id_ = -1;
int frame_tree_node_id_ = -1;
bool is_navigation_ = true;
bool is_download_ = false;
@ -413,7 +410,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
// InterceptedRequestHandler methods:
void OnBeforeRequest(const RequestId& id,
void OnBeforeRequest(int32_t request_id,
network::ResourceRequest* request,
bool request_was_redirected,
OnBeforeRequestResultCallback callback,
@ -429,13 +426,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
if (!init_state_) {
// Queue requests until we're initialized.
pending_requests_.push_back(std::make_unique<PendingRequest>(
id, request, request_was_redirected, std::move(callback),
request_id, request, request_was_redirected, std::move(callback),
std::move(cancel_callback)));
return;
}
// State may already exist for restarted requests.
RequestState* state = GetOrCreateState(id);
RequestState* state = GetOrCreateState(request_id);
// Add standard headers, if currently unspecified.
request->headers.SetHeaderIfMissing(
@ -451,12 +448,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
CefRefPtr<CefRequestImpl> requestPtr;
CefRefPtr<CefResourceRequestHandler> handler =
GetHandler(id, request, &intercept_only, requestPtr);
GetHandler(request_id, request, &intercept_only, requestPtr);
CefRefPtr<CefSchemeHandlerFactory> scheme_factory =
init_state_->iothread_state_->GetSchemeHandlerFactory(request->url);
if (scheme_factory && !requestPtr) {
requestPtr = MakeRequest(request, id.hash(), true);
requestPtr = MakeRequest(request, request_id, true);
}
// True if there's a possibility that the client might handle the request.
@ -483,10 +480,10 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
return;
}
MaybeLoadCookies(id, state, request, std::move(exec_callback));
MaybeLoadCookies(request_id, state, request, std::move(exec_callback));
}
void MaybeLoadCookies(const RequestId& id,
void MaybeLoadCookies(int32_t request_id,
RequestState* state,
network::ResourceRequest* request,
base::OnceClosure callback) {
@ -505,12 +502,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
state->cookie_filter_
? base::BindRepeating(
&InterceptedRequestHandlerWrapper::AllowCookieLoad,
weak_ptr_factory_.GetWeakPtr(), id)
weak_ptr_factory_.GetWeakPtr(), request_id)
: base::BindRepeating(
&InterceptedRequestHandlerWrapper::AllowCookieAlways);
auto done_cookie_callback = base::BindOnce(
&InterceptedRequestHandlerWrapper::ContinueWithLoadedCookies,
weak_ptr_factory_.GetWeakPtr(), id, request, std::move(callback));
weak_ptr_factory_.GetWeakPtr(), request_id, request,
std::move(callback));
cookie_helper::LoadCookies(init_state_->browser_context_, *request,
allow_cookie_callback,
std::move(done_cookie_callback));
@ -521,12 +519,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
*allow = true;
}
void AllowCookieLoad(const RequestId& id,
void AllowCookieLoad(int32_t request_id,
const net::CanonicalCookie& cookie,
bool* allow) {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
RequestState* state = GetState(request_id);
if (!state) {
// The request may have been canceled while the async callback was
// pending.
@ -543,14 +541,14 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
}
void ContinueWithLoadedCookies(const RequestId& id,
void ContinueWithLoadedCookies(int32_t request_id,
network::ResourceRequest* request,
base::OnceClosure callback,
int total_count,
net::CookieList allowed_cookies) {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
RequestState* state = GetState(request_id);
if (!state) {
// The request may have been canceled while the async callback was
// pending.
@ -579,12 +577,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
void ShouldInterceptRequest(
const RequestId& id,
int32_t request_id,
network::ResourceRequest* request,
ShouldInterceptRequestResultCallback callback) override {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
RequestState* state = GetState(request_id);
if (!state) {
// The request may have been canceled during destruction.
return;
@ -603,8 +601,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
CefRefPtr<RequestCallbackWrapper> callbackPtr =
new RequestCallbackWrapper(base::BindOnce(
&InterceptedRequestHandlerWrapper::ContinueShouldInterceptRequest,
weak_ptr_factory_.GetWeakPtr(), id, base::Unretained(request),
std::move(callback)));
weak_ptr_factory_.GetWeakPtr(), request_id,
base::Unretained(request), std::move(callback)));
cef_return_value_t retval = state->handler_->OnBeforeResourceLoad(
init_state_->browser_, init_state_->frame_,
@ -615,18 +613,19 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
} else {
// The scheme factory may choose to handle it.
ContinueShouldInterceptRequest(id, request, std::move(callback), true);
ContinueShouldInterceptRequest(request_id, request, std::move(callback),
true);
}
}
void ContinueShouldInterceptRequest(
const RequestId& id,
int32_t request_id,
network::ResourceRequest* request,
ShouldInterceptRequestResultCallback callback,
bool allow) {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
RequestState* state = GetState(request_id);
if (!state) {
// The request may have been canceled while the async callback was
// pending.
@ -685,7 +684,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
std::unique_ptr<ResourceResponse> resource_response;
if (resource_handler) {
resource_response = CreateResourceResponse(id, resource_handler);
resource_response = CreateResourceResponse(request_id, resource_handler);
DCHECK(resource_response);
state->was_custom_handled_ = true;
} else {
@ -699,13 +698,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
std::move(callback).Run(std::move(resource_response));
}
void ProcessResponseHeaders(const RequestId& id,
void ProcessResponseHeaders(int32_t request_id,
const network::ResourceRequest& request,
const GURL& redirect_url,
net::HttpResponseHeaders* headers) override {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
RequestState* state = GetState(request_id);
if (!state) {
// The request may have been canceled during destruction.
return;
@ -725,14 +724,14 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
state->pending_response_->SetReadOnly(true);
}
void OnRequestResponse(const RequestId& id,
void OnRequestResponse(int32_t request_id,
network::ResourceRequest* request,
net::HttpResponseHeaders* headers,
base::Optional<net::RedirectInfo> redirect_info,
OnRequestResponseResultCallback callback) override {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
RequestState* state = GetState(request_id);
if (!state) {
// The request may have been canceled during destruction.
return;
@ -746,7 +745,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
if (!state->handler_) {
// Cookies may come from a scheme handler.
MaybeSaveCookies(
id, state, request, headers,
request_id, state, request, headers,
base::BindOnce(
std::move(callback), ResponseMode::CONTINUE, nullptr,
redirect_info.has_value() ? redirect_info->new_url : GURL()));
@ -757,14 +756,14 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
DCHECK(state->pending_response_);
if (redirect_info.has_value()) {
HandleRedirect(id, state, request, headers, *redirect_info,
HandleRedirect(request_id, state, request, headers, *redirect_info,
std::move(callback));
} else {
HandleResponse(id, state, request, headers, std::move(callback));
HandleResponse(request_id, state, request, headers, std::move(callback));
}
}
void HandleRedirect(const RequestId& id,
void HandleRedirect(int32_t request_id,
RequestState* state,
network::ResourceRequest* request,
net::HttpResponseHeaders* headers,
@ -797,10 +796,11 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
auto exec_callback = base::BindOnce(
std::move(callback), ResponseMode::CONTINUE, nullptr, new_url);
MaybeSaveCookies(id, state, request, headers, std::move(exec_callback));
MaybeSaveCookies(request_id, state, request, headers,
std::move(exec_callback));
}
void HandleResponse(const RequestId& id,
void HandleResponse(int32_t request_id,
RequestState* state,
network::ResourceRequest* request,
net::HttpResponseHeaders* headers,
@ -846,10 +846,11 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
return;
}
MaybeSaveCookies(id, state, request, headers, std::move(exec_callback));
MaybeSaveCookies(request_id, state, request, headers,
std::move(exec_callback));
}
void MaybeSaveCookies(const RequestId& id,
void MaybeSaveCookies(int32_t request_id,
RequestState* state,
network::ResourceRequest* request,
net::HttpResponseHeaders* headers,
@ -875,23 +876,23 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
state->cookie_filter_
? base::BindRepeating(
&InterceptedRequestHandlerWrapper::AllowCookieSave,
weak_ptr_factory_.GetWeakPtr(), id)
weak_ptr_factory_.GetWeakPtr(), request_id)
: base::BindRepeating(
&InterceptedRequestHandlerWrapper::AllowCookieAlways);
auto done_cookie_callback = base::BindOnce(
&InterceptedRequestHandlerWrapper::ContinueWithSavedCookies,
weak_ptr_factory_.GetWeakPtr(), id, std::move(callback));
weak_ptr_factory_.GetWeakPtr(), request_id, std::move(callback));
cookie_helper::SaveCookies(init_state_->browser_context_, *request, headers,
allow_cookie_callback,
std::move(done_cookie_callback));
}
void AllowCookieSave(const RequestId& id,
void AllowCookieSave(int32_t request_id,
const net::CanonicalCookie& cookie,
bool* allow) {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
RequestState* state = GetState(request_id);
if (!state) {
// The request may have been canceled while the async callback was
// pending.
@ -909,7 +910,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
}
void ContinueWithSavedCookies(const RequestId& id,
void ContinueWithSavedCookies(int32_t request_id,
base::OnceClosure callback,
int total_count,
net::CookieList allowed_cookies) {
@ -918,12 +919,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
mojo::ScopedDataPipeConsumerHandle OnFilterResponseBody(
const RequestId& id,
int32_t request_id,
const network::ResourceRequest& request,
mojo::ScopedDataPipeConsumerHandle body) override {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
RequestState* state = GetState(request_id);
if (!state) {
// The request may have been canceled during destruction.
return body;
@ -937,17 +938,17 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
return CreateResponseFilterHandler(
filter, std::move(body),
base::BindOnce(&InterceptedRequestHandlerWrapper::OnFilterError,
weak_ptr_factory_.GetWeakPtr(), id));
weak_ptr_factory_.GetWeakPtr(), request_id));
}
}
return body;
}
void OnFilterError(const RequestId& id) {
void OnFilterError(int32_t request_id) {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
RequestState* state = GetState(request_id);
if (!state) {
// The request may have been canceled while the async callback was
// pending.
@ -960,12 +961,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
void OnRequestComplete(
const RequestId& id,
int32_t request_id,
const network::ResourceRequest& request,
const network::URLLoaderCompletionStatus& status) override {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
RequestState* state = GetState(request_id);
if (!state) {
// The request may have been aborted during initialization or canceled
// during destruction. This method will always be called before a request
@ -974,7 +975,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
if (!pending_requests_.empty()) {
PendingRequests::iterator it = pending_requests_.begin();
for (; it != pending_requests_.end(); ++it) {
if ((*it)->id_ == id) {
if ((*it)->id_ == request_id) {
pending_requests_.erase(it);
break;
}
@ -1011,7 +1012,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
}
RemoveState(id);
RemoveState(request_id);
}
private:
@ -1045,14 +1046,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
// Returns the handler, if any, that should be used for this request.
CefRefPtr<CefResourceRequestHandler> GetHandler(
const RequestId& id,
int32_t request_id,
network::ResourceRequest* request,
bool* intercept_only,
CefRefPtr<CefRequestImpl>& requestPtr) const {
CefRefPtr<CefResourceRequestHandler> handler;
const int64 request_id = id.hash();
if (init_state_->browser_) {
// Maybe the browser's client wants to handle it?
CefRefPtr<CefClient> client =
@ -1075,8 +1074,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
// Maybe the request context wants to handle it?
CefRefPtr<CefRequestContextHandler> context_handler =
init_state_->iothread_state_->GetHandler(
init_state_->render_process_id_, request->render_frame_id,
init_state_->frame_tree_node_id_, false);
init_state_->render_process_id_, MSG_ROUTING_NONE,
init_state_->frame_tree_node_id_, /*require_frame_match=*/false);
if (context_handler) {
if (!requestPtr)
requestPtr = MakeRequest(request, request_id, true);
@ -1091,24 +1090,24 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
return handler;
}
RequestState* GetOrCreateState(const RequestId& id) {
RequestState* state = GetState(id);
RequestState* GetOrCreateState(int32_t request_id) {
RequestState* state = GetState(request_id);
if (!state) {
state = new RequestState();
request_map_.insert(std::make_pair(id, base::WrapUnique(state)));
request_map_.insert(std::make_pair(request_id, base::WrapUnique(state)));
}
return state;
}
RequestState* GetState(const RequestId& id) const {
RequestMap::const_iterator it = request_map_.find(id);
RequestState* GetState(int32_t request_id) const {
RequestMap::const_iterator it = request_map_.find(request_id);
if (it != request_map_.end())
return it->second.get();
return nullptr;
}
void RemoveState(const RequestId& id) {
RequestMap::iterator it = request_map_.find(id);
void RemoveState(int32_t request_id) {
RequestMap::iterator it = request_map_.find(request_id);
DCHECK(it != request_map_.end());
if (it != request_map_.end())
request_map_.erase(it);
@ -1186,7 +1185,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
bool shutting_down_ = false;
using RequestMap = std::map<RequestId, std::unique_ptr<RequestState>>;
using RequestMap = std::map<int32_t, std::unique_ptr<RequestState>>;
RequestMap request_map_;
using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>;
@ -1220,27 +1219,21 @@ void InitOnUIThread(
content::RenderFrameHost* frame = nullptr;
if (request.render_frame_id >= 0) {
// TODO(network): Are these main frame checks equivalent?
if (request.is_main_frame ||
static_cast<blink::mojom::ResourceType>(request.resource_type) ==
blink::mojom::ResourceType::kMainFrame) {
if (request.is_main_frame ||
static_cast<blink::mojom::ResourceType>(request.resource_type) ==
blink::mojom::ResourceType::kMainFrame) {
frame = web_contents->GetMainFrame();
DCHECK(frame);
} else {
if (frame_tree_node_id >= 0) {
// May return null for frames in inner WebContents.
frame = web_contents->FindFrameByFrameTreeNodeId(frame_tree_node_id,
render_process_id);
}
if (!frame) {
// Use the main frame for the CefBrowserHost.
frame = web_contents->GetMainFrame();
DCHECK(frame);
} else {
// May return null for newly created iframes.
frame = content::RenderFrameHost::FromID(render_process_id,
request.render_frame_id);
if (!frame && frame_tree_node_id >= 0) {
// May return null for frames in inner WebContents.
frame = web_contents->FindFrameByFrameTreeNodeId(frame_tree_node_id,
render_process_id);
}
if (!frame) {
// Use the main frame for the CefBrowserHost.
frame = web_contents->GetMainFrame();
DCHECK(frame);
}
}
}
@ -1270,9 +1263,9 @@ void InitOnUIThread(
auto init_state =
std::make_unique<InterceptedRequestHandlerWrapper::InitState>();
init_state->Initialize(browser_context, browserPtr, framePtr,
render_process_id, request.render_frame_id,
frame_tree_node_id, is_navigation, is_download,
request_initiator, unhandled_request_callback);
render_process_id, frame_tree_node_id, is_navigation,
is_download, request_initiator,
unhandled_request_callback);
init_helper->MaybeSetInitialized(std::move(init_state));
}
@ -1289,12 +1282,10 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
CEF_REQUIRE_UIT();
CefRefPtr<CefBrowserHostBase> browserPtr;
CefRefPtr<CefFrame> framePtr;
int render_frame_id = -1;
int frame_tree_node_id = -1;
// |frame| may be null for service worker requests.
if (frame) {
render_frame_id = frame->GetRoutingID();
frame_tree_node_id = frame->GetFrameTreeNodeId();
// May return nullptr for requests originating from guest views.
@ -1308,9 +1299,8 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
auto init_state =
std::make_unique<InterceptedRequestHandlerWrapper::InitState>();
init_state->Initialize(browser_context, browserPtr, framePtr,
render_process_id, render_frame_id, frame_tree_node_id,
is_navigation, is_download, request_initiator,
base::Closure());
render_process_id, frame_tree_node_id, is_navigation,
is_download, request_initiator, base::Closure());
auto wrapper = std::make_unique<InterceptedRequestHandlerWrapper>();
wrapper->init_helper()->MaybeSetInitialized(std::move(init_state));

View File

@ -14,6 +14,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/browser_thread.h"
@ -37,7 +38,7 @@ class OpenInputStreamWrapper
static base::OnceClosure Open(
std::unique_ptr<StreamReaderURLLoader::Delegate> delegate,
scoped_refptr<base::SequencedTaskRunner> work_thread_task_runner,
const RequestId& request_id,
int32_t request_id,
const network::ResourceRequest& request,
OnInputStreamOpenedCallback callback) WARN_UNUSED_RESULT {
scoped_refptr<OpenInputStreamWrapper> wrapper = new OpenInputStreamWrapper(
@ -62,8 +63,7 @@ class OpenInputStreamWrapper
callback_(std::move(callback)) {}
virtual ~OpenInputStreamWrapper() {}
void Start(const RequestId& request_id,
const network::ResourceRequest& request) {
void Start(int32_t request_id, const network::ResourceRequest& request) {
work_thread_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&OpenInputStreamWrapper::OpenOnWorkThread,
@ -95,7 +95,7 @@ class OpenInputStreamWrapper
OnCallback(nullptr);
}
void OpenOnWorkThread(const RequestId& request_id,
void OpenOnWorkThread(int32_t request_id,
const network::ResourceRequest& request) {
DCHECK(work_thread_task_runner_->RunsTasksInCurrentSequence());
if (is_canceled_)
@ -455,30 +455,12 @@ void InputStreamReader::RunReadCallbackOnJobThread(
std::move(read_callback).Run(bytes_read);
}
//==============================
// RequestId
//==============================
std::string RequestId::ToString() const {
return base::StringPrintf("RequestId(%u, %u)", request_id_, routing_id_);
}
std::string RequestId::ToString(base::StringPiece debug_label) const {
return base::StringPrintf("RequestId[%s](%u, %u)",
debug_label.as_string().c_str(), request_id_,
routing_id_);
}
std::ostream& operator<<(std::ostream& out, const RequestId& request_id) {
return out << request_id.ToString();
}
//==============================
// StreamReaderURLLoader
//=============================
StreamReaderURLLoader::StreamReaderURLLoader(
const RequestId& request_id,
int32_t request_id,
const network::ResourceRequest& request,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
mojo::PendingRemote<network::mojom::TrustedHeaderClient> header_client,
@ -502,7 +484,7 @@ StreamReaderURLLoader::StreamReaderURLLoader(
// All InputStream work will be performed on this task runner.
stream_work_task_runner_ =
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock()});
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()});
}
StreamReaderURLLoader::~StreamReaderURLLoader() {

View File

@ -63,54 +63,6 @@ class InputStream {
ReadCallback callback) = 0;
};
// Unique identifier for RequestHandler callbacks.
// Based on components/viz/common/surfaces/frame_sink_id.h
class RequestId {
public:
constexpr RequestId() : request_id_(0), routing_id_(0) {}
constexpr RequestId(const RequestId& other)
: request_id_(other.request_id_), routing_id_(other.routing_id_) {}
constexpr RequestId(uint32_t request_id, uint32_t routing_id)
: request_id_(request_id), routing_id_(routing_id) {}
constexpr bool is_valid() const {
return request_id_ != 0 || routing_id_ != 0;
}
constexpr uint32_t request_id() const { return request_id_; }
constexpr uint32_t routing_id() const { return routing_id_; }
bool operator==(const RequestId& other) const {
return request_id_ == other.request_id_ && routing_id_ == other.routing_id_;
}
bool operator!=(const RequestId& other) const { return !(*this == other); }
bool operator<(const RequestId& other) const {
return std::tie(request_id_, routing_id_) <
std::tie(other.request_id_, other.routing_id_);
}
size_t hash() const { return base::HashInts(request_id_, routing_id_); }
std::string ToString() const;
std::string ToString(base::StringPiece debug_label) const;
private:
uint32_t request_id_;
uint32_t routing_id_;
};
std::ostream& operator<<(std::ostream& out, const RequestId& request_id);
struct RequestIdHash {
size_t operator()(const RequestId& key) const { return key.hash(); }
};
// Abstract class for handling intercepted resource responses. All methods are
// called on the IO thread unless otherwise indicated.
class ResourceResponse {
@ -125,13 +77,13 @@ class ResourceResponse {
// |callback| to continue the request. Return false to cancel the request.
// |request| may be different from the request used to create the
// StreamReaderURLLoader if a redirect was followed.
virtual bool OpenInputStream(const RequestId& id,
virtual bool OpenInputStream(int32_t request_id,
const network::ResourceRequest& request,
OpenCallback callback) = 0;
// This method is called to populate the response headers.
using HeaderMap = std::multimap<std::string, std::string>;
virtual void GetResponseHeaders(const RequestId& id,
virtual void GetResponseHeaders(int32_t request_id,
int* status_code,
std::string* reason_phrase,
std::string* mime_type,
@ -153,12 +105,12 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
// This method is called if the result of calling OpenInputStream was null.
// The |restarted| parameter is set to true if the request was restarted
// with a new loader.
virtual void OnInputStreamOpenFailed(const RequestId& id,
virtual void OnInputStreamOpenFailed(int32_t request_id,
bool* restarted) = 0;
};
StreamReaderURLLoader(
const RequestId& request_id,
int32_t request_id,
const network::ResourceRequest& request,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
mojo::PendingRemote<network::mojom::TrustedHeaderClient> header_client,
@ -207,7 +159,7 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
bool ParseRange(const net::HttpRequestHeaders& headers);
bool byte_range_valid() const;
const RequestId request_id_;
const int32_t request_id_;
size_t header_length_ = 0;
int64_t total_bytes_read_ = 0;

View File

@ -325,8 +325,9 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
return;
}
current_rwh_for_drag_->DragTargetDragEnter(
*drop_data, transformed_pt, gfx::PointF(screen_pt), ops, modifiers);
current_rwh_for_drag_->DragTargetDragEnter(*drop_data, transformed_pt,
gfx::PointF(screen_pt), ops,
modifiers, base::DoNothing());
}
void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
@ -381,7 +382,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
int modifiers = TranslateWebEventModifiers(event.modifiers);
target_rwh->DragTargetDragOver(transformed_pt, gfx::PointF(screen_pt), ops,
modifiers);
modifiers, base::DoNothing());
}
void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
@ -451,7 +452,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
int modifiers = TranslateWebEventModifiers(event.modifiers);
target_rwh->DragTargetDrop(*drop_data, transformed_pt,
gfx::PointF(screen_pt), modifiers);
gfx::PointF(screen_pt), modifiers,
base::DoNothing());
}
drag_data_ = nullptr;

View File

@ -653,7 +653,7 @@ void CefRenderWidgetHostViewOSR::Destroy() {
}
void CefRenderWidgetHostViewOSR::SetTooltipText(
const base::string16& tooltip_text) {
const std::u16string& tooltip_text) {
if (!browser_impl_.get())
return;
@ -817,7 +817,7 @@ void CefRenderWidgetHostViewOSR::ImeCancelComposition() {
RequestImeCompositionUpdate(false);
}
void CefRenderWidgetHostViewOSR::SelectionChanged(const base::string16& text,
void CefRenderWidgetHostViewOSR::SelectionChanged(const std::u16string& text,
size_t offset,
const gfx::Range& range) {
RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
@ -1406,6 +1406,15 @@ void CefRenderWidgetHostViewOSR::SpeakSelection() {}
void CefRenderWidgetHostViewOSR::SetWindowFrameInScreen(const gfx::Rect& rect) {
}
void CefRenderWidgetHostViewOSR::ShowSharePicker(
const std::string& title,
const std::string& text,
const std::string& url,
const std::vector<std::string>& file_paths,
blink::mojom::ShareService::ShareCallback callback) {
std::move(callback).Run(blink::mojom::ShareError::INTERNAL_ERROR);
}
#endif // defined(OS_MAC)
void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,

View File

@ -134,6 +134,12 @@ class CefRenderWidgetHostViewOSR
void ShowDefinitionForSelection() override;
void SpeakSelection() override;
void SetWindowFrameInScreen(const gfx::Rect& rect) override;
void ShowSharePicker(
const std::string& title,
const std::string& text,
const std::string& url,
const std::vector<std::string>& file_paths,
blink::mojom::ShareService::ShareCallback callback) override;
#endif // defined(OS_MAC)
// RenderWidgetHostViewBase implementation.
@ -144,7 +150,7 @@ class CefRenderWidgetHostViewOSR
void SetIsLoading(bool is_loading) override;
void RenderProcessGone() override;
void Destroy() override;
void SetTooltipText(const base::string16& tooltip_text) override;
void SetTooltipText(const std::u16string& tooltip_text) override;
content::CursorManager* GetCursorManager() override;
gfx::Size GetCompositorViewportPixelSize() override;
void CopyFromSurface(
@ -171,7 +177,7 @@ class CefRenderWidgetHostViewOSR
RenderWidgetHostViewBase* target_view,
gfx::PointF* transformed_point) override;
void DidNavigate() override;
void SelectionChanged(const base::string16& text,
void SelectionChanged(const std::u16string& text,
size_t offset,
const gfx::Range& range) override;
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;

View File

@ -128,7 +128,7 @@ CefWebContentsViewOSR::CreateViewForChildWidget(
render_widget_host, view);
}
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {}
void CefWebContentsViewOSR::SetPageTitle(const std::u16string& title) {}
void CefWebContentsViewOSR::RenderViewReady() {
RenderViewCreated();

View File

@ -50,7 +50,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
content::RenderWidgetHost* render_widget_host) override;
content::RenderWidgetHostViewBase* CreateViewForChildWidget(
content::RenderWidgetHost* render_widget_host) override;
void SetPageTitle(const base::string16& title) override;
void SetPageTitle(const std::u16string& title) override;
void RenderViewReady() override;
void RenderViewHostChanged(content::RenderViewHost* old_host,
content::RenderViewHost* new_host) override;

View File

@ -15,6 +15,7 @@
#include "base/files/file_path.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/values.h"
#include "chrome/browser/accessibility/accessibility_ui.h"
#include "chrome/browser/download/download_prefs.h"
@ -128,9 +129,8 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
// Get sequenced task runner for making sure that file operations are
// executed in expected order (what was previously assured by the FILE
// thread).
sequenced_task_runner = base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::MayBlock(),
base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
sequenced_task_runner = base::ThreadPool::CreateSequencedTaskRunner(
{base::MayBlock(), base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
}
// Used to store user preferences.

View File

@ -42,7 +42,7 @@ void CefPrefStore::RemoveObserver(PrefStore::Observer* observer) {
}
bool CefPrefStore::HasObservers() const {
return observers_.might_have_observers();
return !observers_.empty();
}
bool CefPrefStore::IsInitializationComplete() const {

View File

@ -165,12 +165,9 @@ void SetExtensionPrefs(content::RenderViewHost* rvh,
if (!site_url.SchemeIs(extensions::kExtensionScheme))
return;
content::WebContents* web_contents =
content::WebContents::FromRenderViewHost(rvh);
extensions::ViewType view_type = extensions::GetViewType(web_contents);
const extensions::Extension* extension =
registry->enabled_extensions().GetByID(site_url.host());
extension_webkit_preferences::SetPreferences(extension, view_type, &web);
extension_webkit_preferences::SetPreferences(extension, &web);
}
void SetString(CommandLinePrefStore* prefs,

View File

@ -186,7 +186,7 @@ void CefPrintDialogLinux::ShowDialog(
void CefPrintDialogLinux::PrintDocument(
const printing::MetafilePlayer& metafile,
const base::string16& document_name) {
const std::u16string& document_name) {
// This runs on the print worker thread, does not block the UI thread.
DCHECK(!CEF_CURRENTLY_ON_UIT());
@ -260,7 +260,7 @@ bool CefPrintDialogLinux::UpdateSettings(
}
void CefPrintDialogLinux::SendDocumentToPrinter(
const base::string16& document_name) {
const std::u16string& document_name) {
CEF_REQUIRE_UIT();
if (!handler_.get()) {

View File

@ -49,7 +49,7 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface,
bool has_selection,
PrintingContextLinux::PrintSettingsCallback callback) override;
void PrintDocument(const printing::MetafilePlayer& metafile,
const base::string16& document_name) override;
const std::u16string& document_name) override;
void AddRefToDialog() override;
void ReleaseDialog() override;
@ -73,7 +73,7 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface,
bool get_defaults);
// Prints document named |document_name|.
void SendDocumentToPrinter(const base::string16& document_name);
void SendDocumentToPrinter(const std::u16string& document_name);
// Handles print dialog response.
void OnPrintContinue(CefRefPtr<CefPrintSettings> settings);

View File

@ -12,6 +12,7 @@
#include "base/format_macros.h"
#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/thread_pool.h"
#include "base/threading/thread.h"
#include "net/base/net_errors.h"
#include "net/http/http_request_headers.h"
@ -607,9 +608,9 @@ void CefServerImpl::ShutdownOnUIThread() {
// Make sure the task is executed on shutdown. Otherwise, |thread| might
// be released outside of the correct scope.
base::PostTask(
base::ThreadPool::PostTask(
FROM_HERE,
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
{base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()},
std::move(task));

View File

@ -9,6 +9,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_task_traits.h"
@ -55,11 +56,11 @@
// Sequenced runners at various priorities that always execute all pending tasks
// before shutdown are available via CefTaskRunnerManager and exposed by the CEF
// API.
#define CEF_POST_BLOCKING_TASK(priority, task) \
base::PostTask( \
FROM_HERE, \
{base::ThreadPool(), priority, \
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, base::MayBlock()}, \
#define CEF_POST_BLOCKING_TASK(priority, task) \
base::ThreadPool::PostTask( \
FROM_HERE, \
{priority, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, \
base::MayBlock()}, \
task)
// Post a blocking task that affects UI or responsiveness of future user

View File

@ -23,7 +23,7 @@ class LabelButtonEx : public views::LabelButton {
self->ButtonPressed(event);
},
base::Unretained(this)),
base::string16()) {}
std::u16string()) {}
virtual void ButtonPressed(const ui::Event& event) = 0;
};

View File

@ -31,8 +31,8 @@ void CefMenuRunnerViews::CancelContextMenu() {
window->CancelMenu();
}
bool CefMenuRunnerViews::FormatLabel(base::string16& label) {
bool CefMenuRunnerViews::FormatLabel(std::u16string& label) {
// Remove the accelerator indicator (&) from label strings.
const base::string16::value_type replace[] = {L'&', 0};
return base::ReplaceChars(label, replace, base::string16(), &label);
const std::u16string::value_type replace[] = {L'&', 0};
return base::ReplaceChars(label, replace, std::u16string(), &label);
}

View File

@ -20,7 +20,7 @@ class CefMenuRunnerViews : public CefMenuRunner {
CefMenuModelImpl* model,
const content::ContextMenuParams& params) override;
void CancelContextMenu() override;
bool FormatLabel(base::string16& label) override;
bool FormatLabel(std::u16string& label) override;
private:
CefBrowserViewImpl* browser_view_;

View File

@ -359,7 +359,7 @@ bool CefWindowView::CanMaximize() const {
return cef_delegate()->CanMaximize(GetCefWindow());
}
base::string16 CefWindowView::GetWindowTitle() const {
std::u16string CefWindowView::GetWindowTitle() const {
return title_;
}
@ -471,7 +471,7 @@ display::Display CefWindowView::GetDisplay() const {
return display::Display();
}
void CefWindowView::SetTitle(const base::string16& title) {
void CefWindowView::SetTitle(const std::u16string& title) {
title_ = title;
views::Widget* widget = GetWidget();
if (widget)

View File

@ -57,7 +57,7 @@ class CefWindowView
bool CanResize() const override;
bool CanMinimize() const override;
bool CanMaximize() const override;
base::string16 GetWindowTitle() const override;
std::u16string GetWindowTitle() const override;
gfx::ImageSkia GetWindowIcon() override;
gfx::ImageSkia GetWindowAppIcon() override;
void WindowClosing() override;
@ -79,8 +79,8 @@ class CefWindowView
display::Display GetDisplay() const;
// Set/get the window title.
void SetTitle(const base::string16& title);
base::string16 title() const { return title_; }
void SetTitle(const std::u16string& title);
std::u16string title() const { return title_; }
// Set/get the window icon. This should be a 16x16 icon suitable for use in
// the Windows's title bar.
@ -108,7 +108,7 @@ class CefWindowView
// True if the window is frameless. It might still be resizable and draggable.
bool is_frameless_;
base::string16 title_;
std::u16string title_;
CefRefPtr<CefImage> window_icon_;
CefRefPtr<CefImage> window_app_icon_;

View File

@ -106,8 +106,8 @@ void AlloyContentClient::AddAdditionalSchemes(Schemes* schemes) {
CefAppManager::Get()->AddAdditionalSchemes(schemes);
}
base::string16 AlloyContentClient::GetLocalizedString(int message_id) {
base::string16 value =
std::u16string AlloyContentClient::GetLocalizedString(int message_id) {
std::u16string value =
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(message_id);
if (value.empty())
LOG(ERROR) << "No localized string available for id " << message_id;
@ -115,10 +115,10 @@ base::string16 AlloyContentClient::GetLocalizedString(int message_id) {
return value;
}
base::string16 AlloyContentClient::GetLocalizedString(
std::u16string AlloyContentClient::GetLocalizedString(
int message_id,
const base::string16& replacement) {
base::string16 value = l10n_util::GetStringFUTF16(message_id, replacement);
const std::u16string& replacement) {
std::u16string value = l10n_util::GetStringFUTF16(message_id, replacement);
if (value.empty())
LOG(ERROR) << "No localized string available for id " << message_id;

View File

@ -25,9 +25,9 @@ class AlloyContentClient : public content::ContentClient {
std::vector<content::CdmInfo>* cdms,
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) override;
void AddAdditionalSchemes(Schemes* schemes) override;
base::string16 GetLocalizedString(int message_id) override;
base::string16 GetLocalizedString(int message_id,
const base::string16& replacement) override;
std::u16string GetLocalizedString(int message_id) override;
std::u16string GetLocalizedString(int message_id,
const std::u16string& replacement) override;
base::StringPiece GetDataResource(int resource_id,
ui::ScaleFactor scale_factor) override;
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;

View File

@ -43,7 +43,7 @@ void CefCommandLineImpl::InitFromArgv(int argc, const char* const* argv) {
void CefCommandLineImpl::InitFromString(const CefString& command_line) {
#if defined(OS_WIN)
CEF_VALUE_VERIFY_RETURN_VOID(true);
const base::string16& str16 = command_line;
const std::wstring& str16 = command_line;
mutable_value()->ParseFromString(str16);
#else
NOTREACHED() << "method not supported on this platform";

Some files were not shown because too many files have changed in this diff Show More