Update to Chromium version 91.0.4472.0 (#870763)
This commit is contained in:
parent
b189c7b472
commit
ae4f68f695
1
BUILD.gn
1
BUILD.gn
|
@ -125,7 +125,6 @@ if (is_mac) {
|
||||||
import("//build/config/mac/rules.gni")
|
import("//build/config/mac/rules.gni")
|
||||||
import("//build/util/version.gni")
|
import("//build/util/version.gni")
|
||||||
import("//media/cdm/library_cdm/cdm_paths.gni")
|
import("//media/cdm/library_cdm/cdm_paths.gni")
|
||||||
import("//build/config/mac/base_rules.gni")
|
|
||||||
|
|
||||||
# Template to compile .xib and .storyboard files.
|
# Template to compile .xib and .storyboard files.
|
||||||
#
|
#
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||||
|
|
||||||
{
|
{
|
||||||
'chromium_checkout': 'refs/tags/90.0.4430.0'
|
'chromium_checkout': 'refs/tags/91.0.4472.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
'include/base/cef_platform_thread.h',
|
'include/base/cef_platform_thread.h',
|
||||||
'include/base/cef_ref_counted.h',
|
'include/base/cef_ref_counted.h',
|
||||||
'include/base/cef_scoped_ptr.h',
|
'include/base/cef_scoped_ptr.h',
|
||||||
'include/base/cef_string16.h',
|
|
||||||
'include/base/cef_template_util.h',
|
'include/base/cef_template_util.h',
|
||||||
'include/base/cef_thread_checker.h',
|
'include/base/cef_thread_checker.h',
|
||||||
'include/base/cef_trace_event.h',
|
'include/base/cef_trace_event.h',
|
||||||
|
@ -128,7 +127,6 @@
|
||||||
'libcef_dll/base/cef_lock_impl.cc',
|
'libcef_dll/base/cef_lock_impl.cc',
|
||||||
'libcef_dll/base/cef_logging.cc',
|
'libcef_dll/base/cef_logging.cc',
|
||||||
'libcef_dll/base/cef_ref_counted.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_thread_checker_impl.cc',
|
||||||
'libcef_dll/base/cef_weak_ptr.cc',
|
'libcef_dll/base/cef_weak_ptr.cc',
|
||||||
],
|
],
|
||||||
|
|
|
@ -75,7 +75,6 @@ typedef unsigned short uint16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// UTF-16 character type.
|
// UTF-16 character type.
|
||||||
// This should be kept synchronized with base/strings/string16.h
|
|
||||||
#ifndef char16
|
#ifndef char16
|
||||||
#if defined(WCHAR_T_IS_UTF16)
|
#if defined(WCHAR_T_IS_UTF16)
|
||||||
typedef wchar_t char16;
|
typedef wchar_t char16;
|
||||||
|
|
|
@ -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_
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "include/base/cef_string16.h"
|
|
||||||
#include "include/internal/cef_string_types.h"
|
#include "include/internal/cef_string_types.h"
|
||||||
|
|
||||||
#if defined(USING_CHROMIUM_INCLUDES)
|
#if defined(USING_CHROMIUM_INCLUDES)
|
||||||
|
@ -91,32 +90,34 @@ struct CefStringTraitsWide {
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
#if defined(WCHAR_T_IS_UTF32)
|
#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;
|
cef_string_utf16_t cstr;
|
||||||
memset(&cstr, 0, sizeof(cstr));
|
memset(&cstr, 0, sizeof(cstr));
|
||||||
cef_string_wide_to_utf16(s->str, s->length, &cstr);
|
cef_string_wide_to_utf16(s->str, s->length, &cstr);
|
||||||
base::string16 str;
|
std::u16string str;
|
||||||
if (cstr.length > 0) {
|
if (cstr.length > 0) {
|
||||||
str = base::string16(
|
str = std::u16string(
|
||||||
reinterpret_cast<base::string16::value_type*>(cstr.str), cstr.length);
|
reinterpret_cast<std::u16string::value_type*>(cstr.str), cstr.length);
|
||||||
}
|
}
|
||||||
cef_string_utf16_clear(&cstr);
|
cef_string_utf16_clear(&cstr);
|
||||||
return str;
|
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(
|
return cef_string_utf16_to_wide(
|
||||||
reinterpret_cast<const char16*>(str.c_str()), str.length(), s)
|
reinterpret_cast<const char16*>(str.c_str()), str.length(), s)
|
||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
#else // WCHAR_T_IS_UTF32
|
#else // WCHAR_T_IS_UTF32
|
||||||
static inline base::string16 to_string16(const struct_type* s) {
|
static inline std::u16string to_string16(const struct_type* s) {
|
||||||
return base::string16(
|
return std::u16string(
|
||||||
reinterpret_cast<const base::string16::value_type*>(s->str), s->length);
|
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_wide_set(str.c_str(), str.length(), s, true) ? true
|
return cef_string_wide_set(reinterpret_cast<const wchar_t*>(str.c_str()),
|
||||||
: false;
|
str.length(), s, true)
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
}
|
}
|
||||||
#endif // WCHAR_T_IS_UTF32
|
#endif // WCHAR_T_IS_UTF32
|
||||||
};
|
};
|
||||||
|
@ -169,19 +170,19 @@ struct CefStringTraitsUTF8 {
|
||||||
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
|
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;
|
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;
|
cef_string_utf16_t cstr;
|
||||||
memset(&cstr, 0, sizeof(cstr));
|
memset(&cstr, 0, sizeof(cstr));
|
||||||
cef_string_utf8_to_utf16(s->str, s->length, &cstr);
|
cef_string_utf8_to_utf16(s->str, s->length, &cstr);
|
||||||
base::string16 str;
|
std::u16string str;
|
||||||
if (cstr.length > 0) {
|
if (cstr.length > 0) {
|
||||||
str = base::string16(
|
str = std::u16string(
|
||||||
reinterpret_cast<base::string16::value_type*>(cstr.str), cstr.length);
|
reinterpret_cast<std::u16string::value_type*>(cstr.str), cstr.length);
|
||||||
}
|
}
|
||||||
cef_string_utf16_clear(&cstr);
|
cef_string_utf16_clear(&cstr);
|
||||||
return str;
|
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(
|
return cef_string_utf16_to_utf8(
|
||||||
reinterpret_cast<const char16*>(str.c_str()), str.length(), s)
|
reinterpret_cast<const char16*>(str.c_str()), str.length(), s)
|
||||||
? true
|
? true
|
||||||
|
@ -256,11 +257,11 @@ struct CefStringTraitsUTF16 {
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
#endif // WCHAR_T_IS_UTF32
|
#endif // WCHAR_T_IS_UTF32
|
||||||
static inline base::string16 to_string16(const struct_type* s) {
|
static inline std::u16string to_string16(const struct_type* s) {
|
||||||
return base::string16(
|
return std::u16string(
|
||||||
reinterpret_cast<const base::string16::value_type*>(s->str), s->length);
|
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()),
|
return cef_string_utf16_set(reinterpret_cast<const char16*>(str.c_str()),
|
||||||
str.length(), s, true)
|
str.length(), s, true)
|
||||||
? true
|
? true
|
||||||
|
@ -341,19 +342,25 @@ class CefStringBase {
|
||||||
FromWString(std::wstring(src));
|
FromWString(std::wstring(src));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WCHAR_T_IS_UTF32)
|
|
||||||
///
|
///
|
||||||
// Create a new string from an existing string16. Data will be always
|
// Create a new string from an existing string16. Data will be always
|
||||||
// copied. Translation will occur if necessary based on the underlying string
|
// copied. Translation will occur if necessary based on the underlying string
|
||||||
// type.
|
// type.
|
||||||
///
|
///
|
||||||
CefStringBase(const base::string16& src) : string_(NULL), owner_(false) {
|
CefStringBase(const std::u16string& src) : string_(NULL), owner_(false) {
|
||||||
FromString16(src);
|
FromString16(src);
|
||||||
}
|
}
|
||||||
CefStringBase(const char16* src) : string_(NULL), owner_(false) {
|
CefStringBase(const std::u16string::value_type* src)
|
||||||
|
: string_(NULL), owner_(false) {
|
||||||
if (src)
|
if (src)
|
||||||
FromString16(base::string16(
|
FromString16(std::u16string(src));
|
||||||
reinterpret_cast<const base::string16::value_type*>(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
|
#endif // WCHAR_T_IS_UTF32
|
||||||
|
|
||||||
|
@ -620,9 +627,9 @@ class CefStringBase {
|
||||||
// Return this string's data as a string16. Translation will occur if
|
// Return this string's data as a string16. Translation will occur if
|
||||||
// necessary based on the underlying string type.
|
// necessary based on the underlying string type.
|
||||||
///
|
///
|
||||||
base::string16 ToString16() const {
|
std::u16string ToString16() const {
|
||||||
if (empty())
|
if (empty())
|
||||||
return base::string16();
|
return std::u16string();
|
||||||
return traits::to_string16(string_);
|
return traits::to_string16(string_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +638,7 @@ class CefStringBase {
|
||||||
// copied. Translation will occur if necessary based on the underlying string
|
// copied. Translation will occur if necessary based on the underlying string
|
||||||
// type.
|
// type.
|
||||||
///
|
///
|
||||||
bool FromString16(const base::string16& str) {
|
bool FromString16(const std::u16string& str) {
|
||||||
if (str.empty()) {
|
if (str.empty()) {
|
||||||
clear();
|
clear();
|
||||||
return true;
|
return true;
|
||||||
|
@ -683,15 +690,19 @@ class CefStringBase {
|
||||||
FromWString(std::wstring(str));
|
FromWString(std::wstring(str));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#if defined(WCHAR_T_IS_UTF32)
|
operator std::u16string() const { return ToString16(); }
|
||||||
operator base::string16() const { return ToString16(); }
|
CefStringBase& operator=(const std::u16string& str) {
|
||||||
CefStringBase& operator=(const base::string16& str) {
|
|
||||||
FromString16(str);
|
FromString16(str);
|
||||||
return *this;
|
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) {
|
CefStringBase& operator=(const char16* str) {
|
||||||
FromString16(base::string16(
|
FromString16(std::u16string(
|
||||||
reinterpret_cast<const base::string16::value_type*>(str)));
|
reinterpret_cast<const std::u16string::value_type*>(str)));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#endif // WCHAR_T_IS_UTF32
|
#endif // WCHAR_T_IS_UTF32
|
||||||
|
|
|
@ -309,16 +309,6 @@ AlloyBrowserContext::GetClientHintsControllerDelegate() {
|
||||||
return nullptr;
|
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() {
|
ChromeZoomLevelPrefs* AlloyBrowserContext::GetZoomLevelPrefs() {
|
||||||
return static_cast<ChromeZoomLevelPrefs*>(
|
return static_cast<ChromeZoomLevelPrefs*>(
|
||||||
GetStoragePartition(this, nullptr)->GetZoomLevelDelegate());
|
GetStoragePartition(this, nullptr)->GetZoomLevelDelegate());
|
||||||
|
|
|
@ -60,12 +60,6 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||||
content::ResourceContext* GetResourceContext() override;
|
content::ResourceContext* GetResourceContext() override;
|
||||||
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
|
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
|
||||||
override;
|
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() override;
|
||||||
base::FilePath GetPath() const override;
|
base::FilePath GetPath() const override;
|
||||||
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
||||||
|
|
|
@ -1191,9 +1191,9 @@ void AlloyBrowserHostImpl::UpdateTargetURL(content::WebContents* source,
|
||||||
bool AlloyBrowserHostImpl::DidAddMessageToConsole(
|
bool AlloyBrowserHostImpl::DidAddMessageToConsole(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel level,
|
blink::mojom::ConsoleMessageLevel level,
|
||||||
const base::string16& message,
|
const std::u16string& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const base::string16& source_id) {
|
const std::u16string& source_id) {
|
||||||
return contents_delegate_->DidAddMessageToConsole(source, level, message,
|
return contents_delegate_->DidAddMessageToConsole(source, level, message,
|
||||||
line_no, source_id);
|
line_no, source_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,11 @@
|
||||||
#include "libcef/browser/menu_manager.h"
|
#include "libcef/browser/menu_manager.h"
|
||||||
#include "libcef/browser/request_context_impl.h"
|
#include "libcef/browser/request_context_impl.h"
|
||||||
|
|
||||||
#include "base/strings/string16.h"
|
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/browser/web_contents_delegate.h"
|
#include "content/public/browser/web_contents_delegate.h"
|
||||||
#include "content/public/browser/web_contents_observer.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 CefAudioCapturer;
|
||||||
class CefBrowserInfo;
|
class CefBrowserInfo;
|
||||||
|
@ -222,9 +221,9 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||||
bool DidAddMessageToConsole(content::WebContents* source,
|
bool DidAddMessageToConsole(content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel log_level,
|
blink::mojom::ConsoleMessageLevel log_level,
|
||||||
const base::string16& message,
|
const std::u16string& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const base::string16& source_id) override;
|
const std::u16string& source_id) override;
|
||||||
void BeforeUnloadFired(content::WebContents* source,
|
void BeforeUnloadFired(content::WebContents* source,
|
||||||
bool proceed,
|
bool proceed,
|
||||||
bool* proceed_to_fire_unload) override;
|
bool* proceed_to_fire_unload) override;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
|
#include "base/task/thread_pool.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/media/router/chrome_media_router_factory.h"
|
#include "chrome/browser/media/router/chrome_media_router_factory.h"
|
||||||
#include "chrome/browser/net/system_network_context_manager.h"
|
#include "chrome/browser/net/system_network_context_manager.h"
|
||||||
|
@ -152,7 +153,7 @@ int AlloyBrowserMainParts::PreCreateThreads() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
int AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
||||||
#endif
|
#endif
|
||||||
|
@ -173,14 +174,14 @@ void AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
||||||
// ChromeBrowserMainExtraPartsProfiles for details.
|
// ChromeBrowserMainExtraPartsProfiles for details.
|
||||||
cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
||||||
|
|
||||||
background_task_runner_ = base::CreateSingleThreadTaskRunner(
|
background_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
||||||
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
|
{base::TaskPriority::BEST_EFFORT,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
user_visible_task_runner_ = base::CreateSingleThreadTaskRunner(
|
user_visible_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
||||||
{base::ThreadPool(), base::TaskPriority::USER_VISIBLE,
|
{base::TaskPriority::USER_VISIBLE,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
user_blocking_task_runner_ = base::CreateSingleThreadTaskRunner(
|
user_blocking_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
||||||
{base::ThreadPool(), base::TaskPriority::USER_BLOCKING,
|
{base::TaskPriority::USER_BLOCKING,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
|
|
||||||
CefRequestContextSettings settings;
|
CefRequestContextSettings settings;
|
||||||
|
@ -204,6 +205,8 @@ void AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
||||||
PluginFinder::GetInstance()->Init();
|
PluginFinder::GetInstance()->Init();
|
||||||
|
|
||||||
scheme::RegisterWebUIControllerFactory();
|
scheme::RegisterWebUIControllerFactory();
|
||||||
|
|
||||||
|
return content::RESULT_CODE_NORMAL_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlloyBrowserMainParts::PostMainMessageLoopRun() {
|
void AlloyBrowserMainParts::PostMainMessageLoopRun() {
|
||||||
|
|
|
@ -50,7 +50,7 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
|
||||||
void PreMainMessageLoopStart() override;
|
void PreMainMessageLoopStart() override;
|
||||||
void PostMainMessageLoopStart() override;
|
void PostMainMessageLoopStart() override;
|
||||||
int PreCreateThreads() override;
|
int PreCreateThreads() override;
|
||||||
void PreMainMessageLoopRun() override;
|
int PreMainMessageLoopRun() override;
|
||||||
void PostMainMessageLoopRun() override;
|
void PostMainMessageLoopRun() override;
|
||||||
void PostDestroyThreads() override;
|
void PostDestroyThreads() override;
|
||||||
|
|
||||||
|
|
|
@ -988,9 +988,9 @@ void AlloyContentBrowserClient::DidCreatePpapiPlugin(
|
||||||
new ChromeBrowserPepperHostFactory(browser_host)));
|
new ChromeBrowserPepperHostFactory(browser_host)));
|
||||||
}
|
}
|
||||||
|
|
||||||
content::DevToolsManagerDelegate*
|
std::unique_ptr<content::DevToolsManagerDelegate>
|
||||||
AlloyContentBrowserClient::GetDevToolsManagerDelegate() {
|
AlloyContentBrowserClient::CreateDevToolsManagerDelegate() {
|
||||||
return new CefDevToolsManagerDelegate();
|
return std::make_unique<CefDevToolsManagerDelegate>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
||||||
|
@ -1244,6 +1244,7 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::WebContents::OnceGetter web_contents_getter,
|
content::WebContents::OnceGetter web_contents_getter,
|
||||||
int child_id,
|
int child_id,
|
||||||
|
int frame_tree_node_id,
|
||||||
content::NavigationUIData* navigation_data,
|
content::NavigationUIData* navigation_data,
|
||||||
bool is_main_frame,
|
bool is_main_frame,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
|
|
|
@ -109,7 +109,8 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||||
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
|
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
|
||||||
std::string GetDefaultDownloadName() override;
|
std::string GetDefaultDownloadName() override;
|
||||||
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) 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>>
|
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
||||||
CreateThrottlesForNavigation(
|
CreateThrottlesForNavigation(
|
||||||
content::NavigationHandle* navigation_handle) override;
|
content::NavigationHandle* navigation_handle) override;
|
||||||
|
@ -179,6 +180,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::WebContents::OnceGetter web_contents_getter,
|
content::WebContents::OnceGetter web_contents_getter,
|
||||||
int child_id,
|
int child_id,
|
||||||
|
int frame_tree_node_id,
|
||||||
content::NavigationUIData* navigation_data,
|
content::NavigationUIData* navigation_data,
|
||||||
bool is_main_frame,
|
bool is_main_frame,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
|
|
|
@ -68,10 +68,11 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
|
||||||
extensions::GetExtensionForUrl(browser_context, gurl);
|
extensions::GetExtensionForUrl(browser_context, gurl);
|
||||||
}
|
}
|
||||||
if (create_params.extension) {
|
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.
|
// Default to dialog behavior.
|
||||||
create_params.extension_host_type =
|
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
|
// Extension resources will fail to load if we don't use a SiteInstance
|
||||||
|
@ -191,7 +192,7 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
|
||||||
void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
||||||
const extensions::Extension* extension,
|
const extensions::Extension* extension,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
extensions::ViewType host_type) {
|
extensions::mojom::ViewType host_type) {
|
||||||
REQUIRE_ALLOY_RUNTIME();
|
REQUIRE_ALLOY_RUNTIME();
|
||||||
DCHECK(primary_);
|
DCHECK(primary_);
|
||||||
|
|
||||||
|
@ -202,14 +203,15 @@ void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
||||||
|
|
||||||
auto alloy_browser = static_cast<AlloyBrowserHostImpl*>(browser_);
|
auto alloy_browser = static_cast<AlloyBrowserHostImpl*>(browser_);
|
||||||
|
|
||||||
if (host_type == extensions::VIEW_TYPE_EXTENSION_DIALOG ||
|
if (host_type == extensions::mojom::ViewType::kExtensionDialog ||
|
||||||
host_type == extensions::VIEW_TYPE_EXTENSION_POPUP) {
|
host_type == extensions::mojom::ViewType::kExtensionPopup) {
|
||||||
// Create an extension host that we own.
|
// Create an extension host that we own.
|
||||||
extension_host_ = new extensions::CefExtensionViewHost(
|
extension_host_ = new extensions::CefExtensionViewHost(
|
||||||
alloy_browser, extension, web_contents_, url, host_type);
|
alloy_browser, extension, web_contents_, url, host_type);
|
||||||
// Trigger load of the extension URL.
|
// Trigger load of the extension URL.
|
||||||
extension_host_->CreateRendererSoon();
|
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;
|
is_background_host_ = true;
|
||||||
alloy_browser->is_background_host_ = true;
|
alloy_browser->is_background_host_ = true;
|
||||||
// Create an extension host that will be owned by ProcessManager.
|
// Create an extension host that will be owned by ProcessManager.
|
||||||
|
@ -451,7 +453,7 @@ void CefBrowserPlatformDelegateAlloy::DestroyExtensionHost() {
|
||||||
if (!extension_host_)
|
if (!extension_host_)
|
||||||
return;
|
return;
|
||||||
if (extension_host_->extension_host_type() ==
|
if (extension_host_->extension_host_type() ==
|
||||||
extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
|
extensions::mojom::ViewType::kExtensionBackgroundPage) {
|
||||||
DCHECK(is_background_host_);
|
DCHECK(is_background_host_);
|
||||||
// Close notification for background pages arrives via CloseContents.
|
// Close notification for background pages arrives via CloseContents.
|
||||||
// The extension host will be deleted by
|
// The extension host will be deleted by
|
||||||
|
|
|
@ -33,7 +33,7 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||||
void BrowserCreated(CefBrowserHostBase* browser) override;
|
void BrowserCreated(CefBrowserHostBase* browser) override;
|
||||||
void CreateExtensionHost(const extensions::Extension* extension,
|
void CreateExtensionHost(const extensions::Extension* extension,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
extensions::ViewType host_type) override;
|
extensions::mojom::ViewType host_type) override;
|
||||||
extensions::ExtensionHost* GetExtensionHost() const override;
|
extensions::ExtensionHost* GetExtensionHost() const override;
|
||||||
void BrowserDestroyed(CefBrowserHostBase* browser) override;
|
void BrowserDestroyed(CefBrowserHostBase* browser) override;
|
||||||
void SendCaptureLostEvent() override;
|
void SendCaptureLostEvent() override;
|
||||||
|
|
|
@ -71,7 +71,8 @@ std::string ChromeProfileAlloy::GetProfileUserName() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
Profile* ChromeProfileAlloy::GetOffTheRecordProfile(
|
Profile* ChromeProfileAlloy::GetOffTheRecordProfile(
|
||||||
const Profile::OTRProfileID& otr_profile_id) {
|
const Profile::OTRProfileID& otr_profile_id,
|
||||||
|
bool create_if_needed) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,8 @@ class ChromeProfileAlloy : public Profile {
|
||||||
variations::VariationsClient* GetVariationsClient() override;
|
variations::VariationsClient* GetVariationsClient() override;
|
||||||
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
||||||
std::string GetProfileUserName() const override;
|
std::string GetProfileUserName() const override;
|
||||||
Profile* GetOffTheRecordProfile(
|
Profile* GetOffTheRecordProfile(const Profile::OTRProfileID& otr_profile_id,
|
||||||
const Profile::OTRProfileID& otr_profile_id) override;
|
bool create_if_needed) override;
|
||||||
std::vector<Profile*> GetAllOffTheRecordProfiles() override;
|
std::vector<Profile*> GetAllOffTheRecordProfiles() override;
|
||||||
void DestroyOffTheRecordProfile(Profile* otr_profile) override;
|
void DestroyOffTheRecordProfile(Profile* otr_profile) override;
|
||||||
bool HasOffTheRecordProfile(
|
bool HasOffTheRecordProfile(
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "content/public/browser/notification_source.h"
|
#include "content/public/browser/notification_source.h"
|
||||||
#include "content/public/browser/notification_types.h"
|
#include "content/public/browser/notification_types.h"
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
|
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
|
||||||
|
|
||||||
using content::KeyboardEventProcessingResult;
|
using content::KeyboardEventProcessingResult;
|
||||||
|
|
||||||
|
@ -127,9 +128,9 @@ void CefBrowserContentsDelegate::UpdateTargetURL(content::WebContents* source,
|
||||||
bool CefBrowserContentsDelegate::DidAddMessageToConsole(
|
bool CefBrowserContentsDelegate::DidAddMessageToConsole(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel log_level,
|
blink::mojom::ConsoleMessageLevel log_level,
|
||||||
const base::string16& message,
|
const std::u16string& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const base::string16& source_id) {
|
const std::u16string& source_id) {
|
||||||
if (auto c = client()) {
|
if (auto c = client()) {
|
||||||
if (auto handler = c->GetDisplayHandler()) {
|
if (auto handler = c->GetDisplayHandler()) {
|
||||||
// Use LOGSEVERITY_DEBUG for unrecognized |level| values.
|
// Use LOGSEVERITY_DEBUG for unrecognized |level| values.
|
||||||
|
@ -328,7 +329,8 @@ void CefBrowserContentsDelegate::OnFrameFocused(
|
||||||
OnStateChanged(State::kFocusedFrame);
|
OnStateChanged(State::kFocusedFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContentsDelegate::DocumentAvailableInMainFrame() {
|
void CefBrowserContentsDelegate::DocumentAvailableInMainFrame(
|
||||||
|
content::RenderFrameHost* render_frame_host) {
|
||||||
has_document_ = true;
|
has_document_ = true;
|
||||||
OnStateChanged(State::kDocument);
|
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 c = client()) {
|
||||||
if (auto handler = c->GetDisplayHandler()) {
|
if (auto handler = c->GetDisplayHandler()) {
|
||||||
handler->OnTitleChange(browser(), title);
|
handler->OnTitleChange(browser(), title);
|
||||||
|
|
|
@ -87,9 +87,9 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||||
bool DidAddMessageToConsole(content::WebContents* source,
|
bool DidAddMessageToConsole(content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel log_level,
|
blink::mojom::ConsoleMessageLevel log_level,
|
||||||
const base::string16& message,
|
const std::u16string& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const base::string16& source_id) override;
|
const std::u16string& source_id) override;
|
||||||
void DidNavigateMainFramePostCommit(
|
void DidNavigateMainFramePostCommit(
|
||||||
content::WebContents* web_contents) override;
|
content::WebContents* web_contents) override;
|
||||||
void EnterFullscreenModeForTab(
|
void EnterFullscreenModeForTab(
|
||||||
|
@ -112,7 +112,8 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||||
void RenderViewReady() override;
|
void RenderViewReady() override;
|
||||||
void RenderProcessGone(base::TerminationStatus status) override;
|
void RenderProcessGone(base::TerminationStatus status) override;
|
||||||
void OnFrameFocused(content::RenderFrameHost* render_frame_host) 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 LoadProgressChanged(double progress) override;
|
||||||
void DidStopLoading() override;
|
void DidStopLoading() override;
|
||||||
void DidFinishNavigation(
|
void DidFinishNavigation(
|
||||||
|
@ -163,7 +164,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||||
void OnLoadStart(CefRefPtr<CefFrame> frame,
|
void OnLoadStart(CefRefPtr<CefFrame> frame,
|
||||||
ui::PageTransition transition_type);
|
ui::PageTransition transition_type);
|
||||||
void OnLoadError(CefRefPtr<CefFrame> frame, const GURL& url, int error_code);
|
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 OnFullscreenModeChange(bool fullscreen);
|
||||||
|
|
||||||
void OnStateChanged(State state_changed);
|
void OnStateChanged(State state_changed);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "base/observer_list.h"
|
#include "base/observer_list.h"
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "extensions/common/view_type.h"
|
#include "extensions/common/mojom/view_type.mojom.h"
|
||||||
|
|
||||||
namespace extensions {
|
namespace extensions {
|
||||||
class Extension;
|
class Extension;
|
||||||
|
@ -86,7 +86,8 @@ struct CefBrowserCreateParams {
|
||||||
// ProcessManager::CreateBackgroundHost. Currently used with the alloy
|
// ProcessManager::CreateBackgroundHost. Currently used with the alloy
|
||||||
// runtime only.
|
// runtime only.
|
||||||
const extensions::Extension* extension = nullptr;
|
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
|
// Base class for CefBrowserHost implementations. Includes functionality that is
|
||||||
|
|
|
@ -76,7 +76,7 @@ void CefBrowserPlatformDelegate::BrowserCreated(CefBrowserHostBase* browser) {
|
||||||
void CefBrowserPlatformDelegate::CreateExtensionHost(
|
void CefBrowserPlatformDelegate::CreateExtensionHost(
|
||||||
const extensions::Extension* extension,
|
const extensions::Extension* extension,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
extensions::ViewType host_type) {
|
extensions::mojom::ViewType host_type) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "include/views/cef_browser_view.h"
|
#include "include/views/cef_browser_view.h"
|
||||||
|
|
||||||
#include "base/callback_forward.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/common/page/drag_operation.h"
|
||||||
#include "third_party/blink/public/mojom/page/drag.mojom-forward.h"
|
#include "third_party/blink/public/mojom/page/drag.mojom-forward.h"
|
||||||
#include "third_party/skia/include/core/SkColor.h"
|
#include "third_party/skia/include/core/SkColor.h"
|
||||||
|
@ -134,7 +134,7 @@ class CefBrowserPlatformDelegate {
|
||||||
// Called from AlloyBrowserHostImpl::Create.
|
// Called from AlloyBrowserHostImpl::Create.
|
||||||
virtual void CreateExtensionHost(const extensions::Extension* extension,
|
virtual void CreateExtensionHost(const extensions::Extension* extension,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
extensions::ViewType host_type);
|
extensions::mojom::ViewType host_type);
|
||||||
|
|
||||||
// Returns the current extension host.
|
// Returns the current extension host.
|
||||||
virtual extensions::ExtensionHost* GetExtensionHost() const;
|
virtual extensions::ExtensionHost* GetExtensionHost() const;
|
||||||
|
|
|
@ -115,7 +115,7 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
|
||||||
}
|
}
|
||||||
return std::move(native_delegate);
|
return std::move(native_delegate);
|
||||||
} else if (create_params.extension_host_type ==
|
} 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.
|
// Creating a background extension host without a window.
|
||||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
|
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
|
||||||
CreateNativeDelegate(CefWindowInfo(), background_color);
|
CreateNativeDelegate(CefWindowInfo(), background_color);
|
||||||
|
|
|
@ -57,10 +57,8 @@ void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
|
||||||
// Create or load a specific disk-based profile. May continue
|
// Create or load a specific disk-based profile. May continue
|
||||||
// synchronously or asynchronously.
|
// synchronously or asynchronously.
|
||||||
profile_manager->CreateProfileAsync(
|
profile_manager->CreateProfileAsync(
|
||||||
cache_path_,
|
cache_path_, base::Bind(&ChromeBrowserContext::ProfileCreated,
|
||||||
base::Bind(&ChromeBrowserContext::ProfileCreated,
|
weak_ptr_factory_.GetWeakPtr()));
|
||||||
weak_ptr_factory_.GetWeakPtr()),
|
|
||||||
/*name=*/base::string16(), /*icon_url=*/std::string());
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// All profile directories must be relative to |user_data_dir|.
|
// All profile directories must be relative to |user_data_dir|.
|
||||||
|
|
|
@ -156,9 +156,9 @@ void ChromeBrowserDelegate::UpdateTargetURL(content::WebContents* source,
|
||||||
bool ChromeBrowserDelegate::DidAddMessageToConsole(
|
bool ChromeBrowserDelegate::DidAddMessageToConsole(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel log_level,
|
blink::mojom::ConsoleMessageLevel log_level,
|
||||||
const base::string16& message,
|
const std::u16string& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const base::string16& source_id) {
|
const std::u16string& source_id) {
|
||||||
if (auto delegate = GetDelegateForWebContents(source)) {
|
if (auto delegate = GetDelegateForWebContents(source)) {
|
||||||
return delegate->DidAddMessageToConsole(source, log_level, message, line_no,
|
return delegate->DidAddMessageToConsole(source, log_level, message, line_no,
|
||||||
source_id);
|
source_id);
|
||||||
|
|
|
@ -70,9 +70,9 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||||
bool DidAddMessageToConsole(content::WebContents* source,
|
bool DidAddMessageToConsole(content::WebContents* source,
|
||||||
blink::mojom::ConsoleMessageLevel log_level,
|
blink::mojom::ConsoleMessageLevel log_level,
|
||||||
const base::string16& message,
|
const std::u16string& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const base::string16& source_id) override;
|
const std::u16string& source_id) override;
|
||||||
void DidNavigateMainFramePostCommit(
|
void DidNavigateMainFramePostCommit(
|
||||||
content::WebContents* web_contents) override;
|
content::WebContents* web_contents) override;
|
||||||
void EnterFullscreenModeForTab(
|
void EnterFullscreenModeForTab(
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||||
|
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
|
#include "base/task/thread_pool.h"
|
||||||
|
|
||||||
ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
|
ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
|
||||||
|
|
||||||
|
@ -24,14 +25,14 @@ void ChromeBrowserMainExtraPartsCef::PostProfileInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() {
|
void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() {
|
||||||
background_task_runner_ = base::CreateSingleThreadTaskRunner(
|
background_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
||||||
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
|
{base::TaskPriority::BEST_EFFORT,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
user_visible_task_runner_ = base::CreateSingleThreadTaskRunner(
|
user_visible_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
||||||
{base::ThreadPool(), base::TaskPriority::USER_VISIBLE,
|
{base::TaskPriority::USER_VISIBLE,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
user_blocking_task_runner_ = base::CreateSingleThreadTaskRunner(
|
user_blocking_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
||||||
{base::ThreadPool(), base::TaskPriority::USER_BLOCKING,
|
{base::TaskPriority::USER_BLOCKING,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
|
|
||||||
scheme::RegisterWebUIControllerFactory();
|
scheme::RegisterWebUIControllerFactory();
|
||||||
|
|
|
@ -40,13 +40,15 @@ namespace {
|
||||||
void HandleExternalProtocolHelper(
|
void HandleExternalProtocolHelper(
|
||||||
ChromeContentBrowserClientCef* self,
|
ChromeContentBrowserClientCef* self,
|
||||||
content::WebContents::OnceGetter web_contents_getter,
|
content::WebContents::OnceGetter web_contents_getter,
|
||||||
|
int frame_tree_node_id,
|
||||||
content::NavigationUIData* navigation_data,
|
content::NavigationUIData* navigation_data,
|
||||||
const network::ResourceRequest& resource_request) {
|
const network::ResourceRequest& resource_request) {
|
||||||
// Match the logic of the original call in
|
// Match the logic of the original call in
|
||||||
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
||||||
self->HandleExternalProtocol(
|
self->HandleExternalProtocol(
|
||||||
resource_request.url, std::move(web_contents_getter),
|
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 ==
|
resource_request.resource_type ==
|
||||||
static_cast<int>(blink::mojom::ResourceType::kMainFrame),
|
static_cast<int>(blink::mojom::ResourceType::kMainFrame),
|
||||||
static_cast<ui::PageTransition>(resource_request.transition_type),
|
static_cast<ui::PageTransition>(resource_request.transition_type),
|
||||||
|
@ -227,6 +229,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::WebContents::OnceGetter web_contents_getter,
|
content::WebContents::OnceGetter web_contents_getter,
|
||||||
int child_id,
|
int child_id,
|
||||||
|
int frame_tree_node_id,
|
||||||
content::NavigationUIData* navigation_data,
|
content::NavigationUIData* navigation_data,
|
||||||
bool is_main_frame,
|
bool is_main_frame,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
|
@ -244,9 +247,9 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||||
// HandleExternalProtocolHelper. Forward to the chrome layer for default
|
// HandleExternalProtocolHelper. Forward to the chrome layer for default
|
||||||
// handling.
|
// handling.
|
||||||
return ChromeContentBrowserClient::HandleExternalProtocol(
|
return ChromeContentBrowserClient::HandleExternalProtocol(
|
||||||
url, std::move(web_contents_getter), child_id, navigation_data,
|
url, std::move(web_contents_getter), child_id, frame_tree_node_id,
|
||||||
is_main_frame, page_transition, has_user_gesture, initiating_origin,
|
navigation_data, is_main_frame, page_transition, has_user_gesture,
|
||||||
nullptr);
|
initiating_origin, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||||
|
@ -262,7 +265,8 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||||
web_contents_getter, frame_tree_node_id, resource_request,
|
web_contents_getter, frame_tree_node_id, resource_request,
|
||||||
base::Bind(HandleExternalProtocolHelper, base::Unretained(this),
|
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(
|
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||||
web_contents_getter, std::move(receiver), std::move(request_handler));
|
web_contents_getter, std::move(receiver), std::move(request_handler));
|
||||||
|
|
|
@ -60,6 +60,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::WebContents::OnceGetter web_contents_getter,
|
content::WebContents::OnceGetter web_contents_getter,
|
||||||
int child_id,
|
int child_id,
|
||||||
|
int frame_tree_node_id,
|
||||||
content::NavigationUIData* navigation_data,
|
content::NavigationUIData* navigation_data,
|
||||||
bool is_main_frame,
|
bool is_main_frame,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
|
|
|
@ -119,7 +119,7 @@ bool CefContextMenuParamsImpl::GetDictionarySuggestions(
|
||||||
if (const_value().dictionary_suggestions.empty())
|
if (const_value().dictionary_suggestions.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::vector<base::string16>::const_iterator it =
|
std::vector<std::u16string>::const_iterator it =
|
||||||
const_value().dictionary_suggestions.begin();
|
const_value().dictionary_suggestions.begin();
|
||||||
for (; it != const_value().dictionary_suggestions.end(); ++it)
|
for (; it != const_value().dictionary_suggestions.end(); ++it)
|
||||||
suggestions.push_back(*it);
|
suggestions.push_back(*it);
|
||||||
|
|
|
@ -91,7 +91,7 @@ void CefDevToolsController::RemoveObserver(Observer* observer) {
|
||||||
void CefDevToolsController::DispatchProtocolMessage(
|
void CefDevToolsController::DispatchProtocolMessage(
|
||||||
content::DevToolsAgentHost* agent_host,
|
content::DevToolsAgentHost* agent_host,
|
||||||
base::span<const uint8_t> message) {
|
base::span<const uint8_t> message) {
|
||||||
if (!observers_.might_have_observers())
|
if (observers_.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
|
#include "base/task/thread_pool.h"
|
||||||
#include "base/threading/sequenced_task_runner_handle.h"
|
#include "base/threading/sequenced_task_runner_handle.h"
|
||||||
#include "base/util/values/values_util.h"
|
#include "base/util/values/values_util.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
|
@ -44,8 +45,8 @@ CefDevToolsFileManager::CefDevToolsFileManager(
|
||||||
PrefService* prefs)
|
PrefService* prefs)
|
||||||
: browser_impl_(browser_impl),
|
: browser_impl_(browser_impl),
|
||||||
prefs_(prefs),
|
prefs_(prefs),
|
||||||
file_task_runner_(base::CreateSequencedTaskRunner(
|
file_task_runner_(
|
||||||
{base::ThreadPool(), base::MayBlock()})),
|
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()})),
|
||||||
weak_factory_(this) {}
|
weak_factory_(this) {}
|
||||||
|
|
||||||
void CefDevToolsFileManager::SaveToFile(const std::string& url,
|
void CefDevToolsFileManager::SaveToFile(const std::string& url,
|
||||||
|
|
|
@ -338,7 +338,8 @@ void CefDevToolsFrontend::ReadyToCommitNavigation(
|
||||||
content::DevToolsFrontendHost::SetupExtensionsAPI(frame, script);
|
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.
|
// Don't call AttachClient multiple times for the same DevToolsAgentHost.
|
||||||
// Otherwise it will call AgentHostClosed which closes the DevTools window.
|
// Otherwise it will call AgentHostClosed which closes the DevTools window.
|
||||||
// This may happen in cases where the DevTools content fails to load.
|
// 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)));
|
this, base::as_bytes(base::make_span(protocol_message)));
|
||||||
} else if (method == "loadCompleted") {
|
} else if (method == "loadCompleted") {
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||||
base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"),
|
u"DevToolsAPI.setUseSoftMenu(true);", base::NullCallback());
|
||||||
base::NullCallback());
|
|
||||||
} else if (method == "loadNetworkResource" && params->GetSize() == 3) {
|
} else if (method == "loadNetworkResource" && params->GetSize() == 3) {
|
||||||
// TODO(pfeldman): handle some of the embedder messages in content.
|
// TODO(pfeldman): handle some of the embedder messages in content.
|
||||||
std::string url;
|
std::string url;
|
||||||
|
@ -461,7 +461,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||||
SendMessageAck(request_id, &response);
|
SendMessageAck(request_id, &response);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
auto* partition = content::BrowserContext::GetStoragePartitionForSite(
|
auto* partition = content::BrowserContext::GetStoragePartitionForUrl(
|
||||||
web_contents()->GetBrowserContext(), gurl);
|
web_contents()->GetBrowserContext(), gurl);
|
||||||
url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
|
url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
|
||||||
}
|
}
|
||||||
|
@ -493,8 +493,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||||
update.Get()->RemoveWithoutPathExpansion(name, nullptr);
|
update.Get()->RemoveWithoutPathExpansion(name, nullptr);
|
||||||
} else if (method == "requestFileSystems") {
|
} else if (method == "requestFileSystems") {
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||||
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"),
|
u"DevToolsAPI.fileSystemsLoaded([]);", base::NullCallback());
|
||||||
base::NullCallback());
|
|
||||||
} else if (method == "reattach") {
|
} else if (method == "reattach") {
|
||||||
if (!agent_host_)
|
if (!agent_host_)
|
||||||
return;
|
return;
|
||||||
|
@ -550,7 +549,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||||
std::string param;
|
std::string param;
|
||||||
base::EscapeJSONString(str_message, true, ¶m);
|
base::EscapeJSONString(str_message, true, ¶m);
|
||||||
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
|
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
|
||||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
std::u16string javascript = base::UTF8ToUTF16(code);
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||||
javascript, base::NullCallback());
|
javascript, base::NullCallback());
|
||||||
return;
|
return;
|
||||||
|
@ -564,7 +563,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||||
¶m);
|
¶m);
|
||||||
std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," +
|
std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," +
|
||||||
std::to_string(pos ? 0 : total_size) + ");";
|
std::to_string(pos ? 0 : total_size) + ");";
|
||||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
std::u16string javascript = base::UTF8ToUTF16(code);
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||||
javascript, base::NullCallback());
|
javascript, base::NullCallback());
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||||
// WebContentsObserver overrides
|
// WebContentsObserver overrides
|
||||||
void ReadyToCommitNavigation(
|
void ReadyToCommitNavigation(
|
||||||
content::NavigationHandle* navigation_handle) override;
|
content::NavigationHandle* navigation_handle) override;
|
||||||
void DocumentAvailableInMainFrame() override;
|
void DocumentAvailableInMainFrame(
|
||||||
|
content::RenderFrameHost* render_frame_host) override;
|
||||||
void WebContentsDestroyed() override;
|
void WebContentsDestroyed() override;
|
||||||
|
|
||||||
void SendMessageAck(int request_id, const base::Value* arg1);
|
void SendMessageAck(int request_id, const base::Value* arg1);
|
||||||
|
|
|
@ -56,7 +56,7 @@ void SyncValueStoreCache::RunWithValueStoreForExtension(
|
||||||
// A neat way to implement unlimited storage; if the extension has the
|
// A neat way to implement unlimited storage; if the extension has the
|
||||||
// unlimited storage permission, force through all calls to Set().
|
// unlimited storage permission, force through all calls to Set().
|
||||||
if (extension->permissions_data()->HasAPIPermission(
|
if (extension->permissions_data()->HasAPIPermission(
|
||||||
APIPermission::kUnlimitedStorage)) {
|
mojom::APIPermissionID::kUnlimitedStorage)) {
|
||||||
WeakUnlimitedSettingsStorage unlimited_storage(storage);
|
WeakUnlimitedSettingsStorage unlimited_storage(storage);
|
||||||
std::move(callback).Run(&unlimited_storage);
|
std::move(callback).Run(&unlimited_storage);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -128,7 +128,8 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
|
||||||
|
|
||||||
execute_tab_id_ = browser->GetIdentifier();
|
execute_tab_id_ = browser->GetIdentifier();
|
||||||
details_ = std::move(details);
|
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);
|
return set_init_result(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage(std::string* error) {
|
||||||
execute_tab_id_, error)) {
|
execute_tab_id_, error)) {
|
||||||
if (is_about_url &&
|
if (is_about_url &&
|
||||||
extension()->permissions_data()->active_permissions().HasAPIPermission(
|
extension()->permissions_data()->active_permissions().HasAPIPermission(
|
||||||
APIPermission::kTab)) {
|
mojom::APIPermissionID::kTab)) {
|
||||||
*error = ErrorUtils::FormatErrorMessage(
|
*error = ErrorUtils::FormatErrorMessage(
|
||||||
manifest_errors::kCannotAccessAboutUrl,
|
manifest_errors::kCannotAccessAboutUrl,
|
||||||
rfh->GetLastCommittedURL().spec(),
|
rfh->GetLastCommittedURL().spec(),
|
||||||
|
|
|
@ -23,7 +23,7 @@ CefComponentExtensionResourceManager::CefComponentExtensionResourceManager() {
|
||||||
base::Value dict(base::Value::Type::DICTIONARY);
|
base::Value dict(base::Value::Type::DICTIONARY);
|
||||||
pdf_extension_util::AddStrings(
|
pdf_extension_util::AddStrings(
|
||||||
pdf_extension_util::PdfViewerContext::kPdfViewer, &dict);
|
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::TemplateReplacements pdf_viewer_replacements;
|
||||||
ui::TemplateReplacementsFromDictionaryValue(
|
ui::TemplateReplacementsFromDictionaryValue(
|
||||||
|
|
|
@ -17,7 +17,7 @@ CefExtensionBackgroundHost::CefExtensionBackgroundHost(
|
||||||
const Extension* extension,
|
const Extension* extension,
|
||||||
content::WebContents* host_contents,
|
content::WebContents* host_contents,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
ViewType host_type)
|
mojom::ViewType host_type)
|
||||||
: ExtensionHost(new CefExtensionHostDelegate(browser),
|
: ExtensionHost(new CefExtensionHostDelegate(browser),
|
||||||
extension,
|
extension,
|
||||||
host_contents->GetBrowserContext(),
|
host_contents->GetBrowserContext(),
|
||||||
|
@ -28,7 +28,7 @@ CefExtensionBackgroundHost::CefExtensionBackgroundHost(
|
||||||
DCHECK(!deleted_callback_.is_null());
|
DCHECK(!deleted_callback_.is_null());
|
||||||
|
|
||||||
// Only used for background pages.
|
// Only used for background pages.
|
||||||
DCHECK(host_type == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE);
|
DCHECK(host_type == mojom::ViewType::kExtensionBackgroundPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefExtensionBackgroundHost::~CefExtensionBackgroundHost() {
|
CefExtensionBackgroundHost::~CefExtensionBackgroundHost() {
|
||||||
|
|
|
@ -29,7 +29,7 @@ class CefExtensionBackgroundHost : public ExtensionHost {
|
||||||
const Extension* extension,
|
const Extension* extension,
|
||||||
content::WebContents* host_contents,
|
content::WebContents* host_contents,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
ViewType host_type);
|
mojom::ViewType host_type);
|
||||||
~CefExtensionBackgroundHost() override;
|
~CefExtensionBackgroundHost() override;
|
||||||
|
|
||||||
// content::WebContentsDelegate methods:
|
// content::WebContentsDelegate methods:
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/task/post_task.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/api/tabs/tabs_constants.h"
|
||||||
#include "chrome/browser/extensions/extension_tab_util.h"
|
#include "chrome/browser/extensions/extension_tab_util.h"
|
||||||
#include "chrome/browser/profiles/profile.h"
|
#include "chrome/browser/profiles/profile.h"
|
||||||
|
@ -81,10 +82,9 @@ class CefGetExtensionLoadFileCallbackImpl
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
base::PostTaskAndReplyWithResult(
|
base::ThreadPool::PostTaskAndReplyWithResult(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
{base::ThreadPool(), base::MayBlock(),
|
{base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
|
||||||
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
|
|
||||||
base::BindOnce(LoadFileFromStream, file, stream), std::move(callback));
|
base::BindOnce(LoadFileFromStream, file, stream), std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -547,7 +547,8 @@ scoped_refptr<const Extension> CefExtensionSystem::CreateExtension(
|
||||||
// Tests should continue to use the Manifest::COMMAND_LINE value here
|
// Tests should continue to use the Manifest::COMMAND_LINE value here
|
||||||
// Some Chrome APIs will cause undesired effects if this is incorrect
|
// Some Chrome APIs will cause undesired effects if this is incorrect
|
||||||
// e.g.: alarms API has 1 minute minimum applied to Packed Extensions
|
// 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);
|
*info.manifest, flags, utf8_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ CefExtensionViewHost::CefExtensionViewHost(AlloyBrowserHostImpl* browser,
|
||||||
const Extension* extension,
|
const Extension* extension,
|
||||||
content::WebContents* host_contents,
|
content::WebContents* host_contents,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
ViewType host_type)
|
mojom::ViewType host_type)
|
||||||
: ExtensionHost(new CefExtensionHostDelegate(browser),
|
: ExtensionHost(new CefExtensionHostDelegate(browser),
|
||||||
extension,
|
extension,
|
||||||
host_contents->GetBrowserContext(),
|
host_contents->GetBrowserContext(),
|
||||||
|
@ -33,8 +33,8 @@ CefExtensionViewHost::CefExtensionViewHost(AlloyBrowserHostImpl* browser,
|
||||||
url,
|
url,
|
||||||
host_type) {
|
host_type) {
|
||||||
// Only used for dialogs and popups.
|
// Only used for dialogs and popups.
|
||||||
DCHECK(host_type == VIEW_TYPE_EXTENSION_DIALOG ||
|
DCHECK(host_type == mojom::ViewType::kExtensionDialog ||
|
||||||
host_type == VIEW_TYPE_EXTENSION_POPUP);
|
host_type == mojom::ViewType::kExtensionPopup);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefExtensionViewHost::~CefExtensionViewHost() {}
|
CefExtensionViewHost::~CefExtensionViewHost() {}
|
||||||
|
@ -76,7 +76,7 @@ bool CefExtensionViewHost::PreHandleGestureEvent(
|
||||||
}
|
}
|
||||||
|
|
||||||
WebContents* CefExtensionViewHost::GetVisibleWebContents() const {
|
WebContents* CefExtensionViewHost::GetVisibleWebContents() const {
|
||||||
if (extension_host_type() == VIEW_TYPE_EXTENSION_POPUP)
|
if (extension_host_type() == mojom::ViewType::kExtensionPopup)
|
||||||
return host_contents();
|
return host_contents();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class CefExtensionViewHost : public ExtensionHost,
|
||||||
const Extension* extension,
|
const Extension* extension,
|
||||||
content::WebContents* host_contents,
|
content::WebContents* host_contents,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
ViewType host_type);
|
mojom::ViewType host_type);
|
||||||
~CefExtensionViewHost() override;
|
~CefExtensionViewHost() override;
|
||||||
|
|
||||||
// ExtensionHost methods:
|
// ExtensionHost methods:
|
||||||
|
|
|
@ -264,8 +264,7 @@ bool CefExtensionsBrowserClient::CreateBackgroundExtensionHost(
|
||||||
|
|
||||||
// This triggers creation of the background host.
|
// This triggers creation of the background host.
|
||||||
create_params.extension = extension;
|
create_params.extension = extension;
|
||||||
create_params.extension_host_type =
|
create_params.extension_host_type = mojom::ViewType::kExtensionBackgroundPage;
|
||||||
extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE;
|
|
||||||
|
|
||||||
// Browser creation may fail under certain rare circumstances. Fail the
|
// Browser creation may fail under certain rare circumstances. Fail the
|
||||||
// background host creation in that case.
|
// background host creation in that case.
|
||||||
|
|
|
@ -92,17 +92,17 @@ ValueStore::WriteResult CefValueStore::Set(
|
||||||
if (!status_.ok())
|
if (!status_.ok())
|
||||||
return WriteResult(CreateStatusCopy(status_));
|
return WriteResult(CreateStatusCopy(status_));
|
||||||
|
|
||||||
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
|
ValueStoreChangeList changes;
|
||||||
for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd();
|
for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd();
|
||||||
it.Advance()) {
|
it.Advance()) {
|
||||||
base::Value* old_value = nullptr;
|
base::Value* old_value = NULL;
|
||||||
if (!storage_.GetWithoutPathExpansion(it.key(), &old_value) ||
|
if (!storage_.GetWithoutPathExpansion(it.key(), &old_value) ||
|
||||||
!old_value->Equals(&it.value())) {
|
!old_value->Equals(&it.value())) {
|
||||||
changes->push_back(ValueStoreChange(
|
changes.emplace_back(it.key(),
|
||||||
it.key(),
|
old_value
|
||||||
old_value ? base::Optional<base::Value>(old_value->Clone())
|
? base::Optional<base::Value>(old_value->Clone())
|
||||||
: base::nullopt,
|
: base::nullopt,
|
||||||
it.value().Clone()));
|
it.value().Clone());
|
||||||
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
|
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,13 +119,11 @@ ValueStore::WriteResult CefValueStore::Remove(
|
||||||
if (!status_.ok())
|
if (!status_.ok())
|
||||||
return WriteResult(CreateStatusCopy(status_));
|
return WriteResult(CreateStatusCopy(status_));
|
||||||
|
|
||||||
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
|
ValueStoreChangeList changes;
|
||||||
for (std::vector<std::string>::const_iterator it = keys.begin();
|
for (auto it = keys.cbegin(); it != keys.cend(); ++it) {
|
||||||
it != keys.end(); ++it) {
|
|
||||||
std::unique_ptr<base::Value> old_value;
|
std::unique_ptr<base::Value> old_value;
|
||||||
if (storage_.RemoveWithoutPathExpansion(*it, &old_value)) {
|
if (storage_.RemoveWithoutPathExpansion(*it, &old_value)) {
|
||||||
changes->push_back(
|
changes.emplace_back(*it, std::move(*old_value), base::nullopt);
|
||||||
ValueStoreChange(*it, std::move(*old_value), base::nullopt));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return WriteResult(std::move(changes), CreateStatusCopy(status_));
|
return WriteResult(std::move(changes), CreateStatusCopy(status_));
|
||||||
|
|
|
@ -274,7 +274,7 @@ void CefFileDialogManager::RunFileChooserInternal(
|
||||||
if (params.hidereadonly)
|
if (params.hidereadonly)
|
||||||
mode |= FILE_DIALOG_HIDEREADONLY_FLAG;
|
mode |= FILE_DIALOG_HIDEREADONLY_FLAG;
|
||||||
|
|
||||||
std::vector<base::string16>::const_iterator it;
|
std::vector<std::u16string>::const_iterator it;
|
||||||
|
|
||||||
std::vector<CefString> accept_filters;
|
std::vector<CefString> accept_filters;
|
||||||
it = params.accept_types.begin();
|
it = params.accept_types.begin();
|
||||||
|
@ -357,7 +357,7 @@ void CefFileDialogManager::OnRunFileChooserDelegateCallback(
|
||||||
// Convert FilePath list to SelectedFileInfo list.
|
// Convert FilePath list to SelectedFileInfo list.
|
||||||
for (size_t i = 0; i < file_paths.size(); ++i) {
|
for (size_t i = 0; i < file_paths.size(); ++i) {
|
||||||
auto info = blink::mojom::FileChooserFileInfo::NewNativeFile(
|
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));
|
selected_files.push_back(std::move(info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ class CefJSDialogCallbackImpl : public CefJSDialogCallback {
|
||||||
private:
|
private:
|
||||||
static void CancelNow(CallbackType callback) {
|
static void CancelNow(CallbackType callback) {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
std::move(callback).Run(false, base::string16());
|
std::move(callback).Run(false, std::u16string());
|
||||||
}
|
}
|
||||||
|
|
||||||
CallbackType callback_;
|
CallbackType callback_;
|
||||||
|
@ -82,8 +82,8 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
content::JavaScriptDialogType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& message_text,
|
const std::u16string& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const std::u16string& default_prompt_text,
|
||||||
DialogClosedCallback callback,
|
DialogClosedCallback callback,
|
||||||
bool* did_suppress_message) {
|
bool* did_suppress_message) {
|
||||||
const GURL& origin_url = render_frame_host->GetLastCommittedURL();
|
const GURL& origin_url = render_frame_host->GetLastCommittedURL();
|
||||||
|
@ -128,7 +128,7 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
|
||||||
|
|
||||||
dialog_running_ = true;
|
dialog_running_ = true;
|
||||||
|
|
||||||
const base::string16& display_url =
|
const std::u16string& display_url =
|
||||||
url_formatter::FormatUrlForSecurityDisplay(origin_url);
|
url_formatter::FormatUrlForSecurityDisplay(origin_url);
|
||||||
|
|
||||||
DCHECK(!callback.is_null());
|
DCHECK(!callback.is_null());
|
||||||
|
@ -147,12 +147,11 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
||||||
AlloyBrowserHostImpl::DESTRUCTION_STATE_ACCEPTED) {
|
AlloyBrowserHostImpl::DESTRUCTION_STATE_ACCEPTED) {
|
||||||
// Currently destroying the browser. Accept the unload without showing
|
// Currently destroying the browser. Accept the unload without showing
|
||||||
// the prompt.
|
// the prompt.
|
||||||
std::move(callback).Run(true, base::string16());
|
std::move(callback).Run(true, std::u16string());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const base::string16& message_text =
|
const std::u16string& message_text = u"Is it OK to leave/reload this page?";
|
||||||
base::ASCIIToUTF16("Is it OK to leave/reload this page?");
|
|
||||||
|
|
||||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
if (client.get()) {
|
if (client.get()) {
|
||||||
|
@ -179,7 +178,7 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
||||||
LOG(WARNING) << "No javascript dialog runner available for this platform";
|
LOG(WARNING) << "No javascript dialog runner available for this platform";
|
||||||
// Suppress the dialog if there is no platform runner or if the dialog is
|
// Suppress the dialog if there is no platform runner or if the dialog is
|
||||||
// currently running.
|
// currently running.
|
||||||
std::move(callback).Run(true, base::string16());
|
std::move(callback).Run(true, std::u16string());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,9 +187,9 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
||||||
DCHECK(!callback.is_null());
|
DCHECK(!callback.is_null());
|
||||||
runner_->Run(
|
runner_->Run(
|
||||||
browser_, content::JAVASCRIPT_DIALOG_TYPE_CONFIRM,
|
browser_, content::JAVASCRIPT_DIALOG_TYPE_CONFIRM,
|
||||||
base::string16(), // display_url
|
std::u16string(), // display_url
|
||||||
message_text,
|
message_text,
|
||||||
base::string16(), // default_prompt_text
|
std::u16string(), // default_prompt_text
|
||||||
base::BindOnce(&CefJavaScriptDialogManager::DialogClosed,
|
base::BindOnce(&CefJavaScriptDialogManager::DialogClosed,
|
||||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
|
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
|
||||||
}
|
}
|
||||||
|
@ -216,7 +215,7 @@ void CefJavaScriptDialogManager::CancelDialogs(
|
||||||
void CefJavaScriptDialogManager::DialogClosed(
|
void CefJavaScriptDialogManager::DialogClosed(
|
||||||
DialogClosedCallback callback,
|
DialogClosedCallback callback,
|
||||||
bool success,
|
bool success,
|
||||||
const base::string16& user_input) {
|
const std::u16string& user_input) {
|
||||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
if (client.get()) {
|
if (client.get()) {
|
||||||
CefRefPtr<CefJSDialogHandler> handler = client->GetJSDialogHandler();
|
CefRefPtr<CefJSDialogHandler> handler = client->GetJSDialogHandler();
|
||||||
|
|
|
@ -31,8 +31,8 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
||||||
void RunJavaScriptDialog(content::WebContents* web_contents,
|
void RunJavaScriptDialog(content::WebContents* web_contents,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
content::JavaScriptDialogType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& message_text,
|
const std::u16string& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const std::u16string& default_prompt_text,
|
||||||
DialogClosedCallback callback,
|
DialogClosedCallback callback,
|
||||||
bool* did_suppress_message) override;
|
bool* did_suppress_message) override;
|
||||||
void RunBeforeUnloadDialog(content::WebContents* web_contents,
|
void RunBeforeUnloadDialog(content::WebContents* web_contents,
|
||||||
|
@ -46,7 +46,7 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
||||||
// Method executed by the callback passed to CefJavaScriptDialogRunner::Run.
|
// Method executed by the callback passed to CefJavaScriptDialogRunner::Run.
|
||||||
void DialogClosed(DialogClosedCallback callback,
|
void DialogClosed(DialogClosedCallback callback,
|
||||||
bool success,
|
bool success,
|
||||||
const base::string16& user_input);
|
const std::u16string& user_input);
|
||||||
|
|
||||||
// AlloyBrowserHostImpl pointer is guaranteed to outlive this object.
|
// AlloyBrowserHostImpl pointer is guaranteed to outlive this object.
|
||||||
AlloyBrowserHostImpl* browser_;
|
AlloyBrowserHostImpl* browser_;
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/strings/string16.h"
|
|
||||||
#include "content/public/common/javascript_dialog_type.h"
|
#include "content/public/common/javascript_dialog_type.h"
|
||||||
|
|
||||||
class AlloyBrowserHostImpl;
|
class AlloyBrowserHostImpl;
|
||||||
|
@ -16,15 +15,15 @@ class AlloyBrowserHostImpl;
|
||||||
class CefJavaScriptDialogRunner {
|
class CefJavaScriptDialogRunner {
|
||||||
public:
|
public:
|
||||||
typedef base::OnceCallback<void(bool /* success */,
|
typedef base::OnceCallback<void(bool /* success */,
|
||||||
const base::string16& /* user_input */)>
|
const std::u16string& /* user_input */)>
|
||||||
DialogClosedCallback;
|
DialogClosedCallback;
|
||||||
|
|
||||||
// Run the dialog. Execute |callback| on completion.
|
// Run the dialog. Execute |callback| on completion.
|
||||||
virtual void Run(AlloyBrowserHostImpl* browser,
|
virtual void Run(AlloyBrowserHostImpl* browser,
|
||||||
content::JavaScriptDialogType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& display_url,
|
const std::u16string& display_url,
|
||||||
const base::string16& message_text,
|
const std::u16string& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const std::u16string& default_prompt_text,
|
||||||
DialogClosedCallback callback) = 0;
|
DialogClosedCallback callback) = 0;
|
||||||
|
|
||||||
// Cancel a dialog mid-flight.
|
// Cancel a dialog mid-flight.
|
||||||
|
|
|
@ -99,7 +99,7 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
||||||
storage.reserve(argv.size());
|
storage.reserve(argv.size());
|
||||||
for (size_t i = 0; i < argv.size(); ++i) {
|
for (size_t i = 0; i < argv.size(); ++i) {
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
storage.push_back(base::UTF16ToUTF8(argv[i]));
|
storage.push_back(base::WideToUTF8(argv[i]));
|
||||||
#else
|
#else
|
||||||
storage.push_back(argv[i]);
|
storage.push_back(argv[i]);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,11 +19,12 @@
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/browser/render_widget_host_view.h"
|
#include "content/public/browser/render_widget_host_view.h"
|
||||||
|
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
CefString GetLabel(int message_id) {
|
CefString GetLabel(int message_id) {
|
||||||
base::string16 label =
|
std::u16string label =
|
||||||
CefAppManager::Get()->GetContentClient()->GetLocalizedString(message_id);
|
CefAppManager::Get()->GetContentClient()->GetLocalizedString(message_id);
|
||||||
DCHECK(!label.empty());
|
DCHECK(!label.empty());
|
||||||
return label;
|
return label;
|
||||||
|
@ -267,7 +268,7 @@ void CefMenuManager::MenuClosed(CefRefPtr<CefMenuModelImpl> source) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefMenuManager::FormatLabel(CefRefPtr<CefMenuModelImpl> source,
|
bool CefMenuManager::FormatLabel(CefRefPtr<CefMenuModelImpl> source,
|
||||||
base::string16& label) {
|
std::u16string& label) {
|
||||||
if (!runner_)
|
if (!runner_)
|
||||||
return false;
|
return false;
|
||||||
return runner_->FormatLabel(label);
|
return runner_->FormatLabel(label);
|
||||||
|
|
|
@ -47,7 +47,7 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
|
||||||
void MenuWillShow(CefRefPtr<CefMenuModelImpl> source) override;
|
void MenuWillShow(CefRefPtr<CefMenuModelImpl> source) override;
|
||||||
void MenuClosed(CefRefPtr<CefMenuModelImpl> source) override;
|
void MenuClosed(CefRefPtr<CefMenuModelImpl> source) override;
|
||||||
bool FormatLabel(CefRefPtr<CefMenuModelImpl> source,
|
bool FormatLabel(CefRefPtr<CefMenuModelImpl> source,
|
||||||
base::string16& label) override;
|
std::u16string& label) override;
|
||||||
|
|
||||||
void ExecuteCommandCallback(int command_id, cef_event_flags_t event_flags);
|
void ExecuteCommandCallback(int command_id, cef_event_flags_t event_flags);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ class CefSimpleMenuModel : public ui::MenuModel {
|
||||||
return impl_->GetCommandIdAt(index);
|
return impl_->GetCommandIdAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
base::string16 GetLabelAt(int index) const override {
|
std::u16string GetLabelAt(int index) const override {
|
||||||
return impl_->GetFormattedLabelAt(index);
|
return impl_->GetFormattedLabelAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -886,8 +886,8 @@ void CefMenuModelImpl::MenuWillClose() {
|
||||||
FROM_HERE, base::Bind(&CefMenuModelImpl::OnMenuClosed, this));
|
FROM_HERE, base::Bind(&CefMenuModelImpl::OnMenuClosed, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
base::string16 CefMenuModelImpl::GetFormattedLabelAt(int index) {
|
std::u16string CefMenuModelImpl::GetFormattedLabelAt(int index) {
|
||||||
base::string16 label = GetLabelAt(index).ToString16();
|
std::u16string label = GetLabelAt(index).ToString16();
|
||||||
if (delegate_)
|
if (delegate_)
|
||||||
delegate_->FormatLabel(this, label);
|
delegate_->FormatLabel(this, label);
|
||||||
if (menu_model_delegate_) {
|
if (menu_model_delegate_) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ class CefMenuModelImpl : public CefMenuModel {
|
||||||
|
|
||||||
// Allows the delegate to modify a menu item label before it's displayed.
|
// Allows the delegate to modify a menu item label before it's displayed.
|
||||||
virtual bool FormatLabel(CefRefPtr<CefMenuModelImpl> source,
|
virtual bool FormatLabel(CefRefPtr<CefMenuModelImpl> source,
|
||||||
base::string16& label) = 0;
|
std::u16string& label) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Delegate() {}
|
virtual ~Delegate() {}
|
||||||
|
@ -166,7 +166,7 @@ class CefMenuModelImpl : public CefMenuModel {
|
||||||
SkColor* override_color) const;
|
SkColor* override_color) const;
|
||||||
void MenuWillShow();
|
void MenuWillShow();
|
||||||
void MenuWillClose();
|
void MenuWillClose();
|
||||||
base::string16 GetFormattedLabelAt(int index);
|
std::u16string GetFormattedLabelAt(int index);
|
||||||
const gfx::FontList* GetLabelFontListAt(int index) const;
|
const gfx::FontList* GetLabelFontListAt(int index) const;
|
||||||
|
|
||||||
// Verify that only a single reference exists to all CefMenuModelImpl objects.
|
// Verify that only a single reference exists to all CefMenuModelImpl objects.
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
#define CEF_LIBCEF_BROWSER_MENU_RUNNER_H_
|
#define CEF_LIBCEF_BROWSER_MENU_RUNNER_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/strings/string16.h"
|
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
struct ContextMenuParams;
|
struct ContextMenuParams;
|
||||||
|
@ -24,7 +24,7 @@ class CefMenuRunner {
|
||||||
CefMenuModelImpl* model,
|
CefMenuModelImpl* model,
|
||||||
const content::ContextMenuParams& params) = 0;
|
const content::ContextMenuParams& params) = 0;
|
||||||
virtual void CancelContextMenu() {}
|
virtual void CancelContextMenu() {}
|
||||||
virtual bool FormatLabel(base::string16& label) { return false; }
|
virtual bool FormatLabel(std::u16string& label) { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Allow deletion via scoped_ptr only.
|
// Allow deletion via scoped_ptr only.
|
||||||
|
|
|
@ -295,7 +295,7 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent(
|
||||||
ui::KeycodeConverter::NativeKeycodeToDomCode(key_event.native_key_code);
|
ui::KeycodeConverter::NativeKeycodeToDomCode(key_event.native_key_code);
|
||||||
int keysym = ui::XKeysymForWindowsKeyCode(
|
int keysym = ui::XKeysymForWindowsKeyCode(
|
||||||
key_code, !!(key_event.modifiers & EVENTFLAG_SHIFT_DOWN));
|
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();
|
base::TimeTicks time_stamp = GetEventTimeStamp();
|
||||||
|
|
||||||
if (key_event.type == KEYEVENT_CHAR) {
|
if (key_event.type == KEYEVENT_CHAR) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ const int kMaxAddressLengthChars = 2048;
|
||||||
bool HasExternalHandler(const std::string& scheme) {
|
bool HasExternalHandler(const std::string& scheme) {
|
||||||
base::win::RegKey key;
|
base::win::RegKey key;
|
||||||
const std::wstring registry_path =
|
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);
|
key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ);
|
||||||
if (key.Valid()) {
|
if (key.Valid()) {
|
||||||
DWORD size = 0;
|
DWORD size = 0;
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace cursor_util {
|
||||||
cef_cursor_handle_t GetPlatformCursor(ui::mojom::CursorType type) {
|
cef_cursor_handle_t GetPlatformCursor(ui::mojom::CursorType type) {
|
||||||
auto cursor = ui::CursorFactory::GetInstance()->GetDefaultCursor(type);
|
auto cursor = ui::CursorFactory::GetInstance()->GetDefaultCursor(type);
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
return ToCursorHandle(*cursor);
|
return ToCursorHandle(cursor);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,12 +47,16 @@ LPCWSTR ToCursorID(ui::mojom::CursorType type) {
|
||||||
return IDC_SIZENESW;
|
return IDC_SIZENESW;
|
||||||
case ui::mojom::CursorType::kWestResize:
|
case ui::mojom::CursorType::kWestResize:
|
||||||
return IDC_SIZEWE;
|
return IDC_SIZEWE;
|
||||||
|
case ui::mojom::CursorType::kNorthSouthNoResize:
|
||||||
case ui::mojom::CursorType::kNorthSouthResize:
|
case ui::mojom::CursorType::kNorthSouthResize:
|
||||||
return IDC_SIZENS;
|
return IDC_SIZENS;
|
||||||
|
case ui::mojom::CursorType::kEastWestNoResize:
|
||||||
case ui::mojom::CursorType::kEastWestResize:
|
case ui::mojom::CursorType::kEastWestResize:
|
||||||
return IDC_SIZEWE;
|
return IDC_SIZEWE;
|
||||||
|
case ui::mojom::CursorType::kNorthEastSouthWestNoResize:
|
||||||
case ui::mojom::CursorType::kNorthEastSouthWestResize:
|
case ui::mojom::CursorType::kNorthEastSouthWestResize:
|
||||||
return IDC_SIZENESW;
|
return IDC_SIZENESW;
|
||||||
|
case ui::mojom::CursorType::kNorthWestSouthEastNoResize:
|
||||||
case ui::mojom::CursorType::kNorthWestSouthEastResize:
|
case ui::mojom::CursorType::kNorthWestSouthEastResize:
|
||||||
return IDC_SIZENWSE;
|
return IDC_SIZENWSE;
|
||||||
case ui::mojom::CursorType::kColumnResize:
|
case ui::mojom::CursorType::kColumnResize:
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
namespace {
|
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.
|
// Check for wild card mime types and return an appropriate description.
|
||||||
static const struct {
|
static const struct {
|
||||||
const char* mime_type;
|
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 l10n_util::GetStringUTF16(kWildCardMimeTypes[i].string_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base::string16();
|
return std::u16string();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFilters(NSPopUpButton* button,
|
void AddFilters(NSPopUpButton* button,
|
||||||
const std::vector<base::string16>& accept_filters,
|
const std::vector<std::u16string>& accept_filters,
|
||||||
bool include_all_files,
|
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) {
|
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())
|
if (filter.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::vector<base::string16> extensions;
|
std::vector<std::u16string> extensions;
|
||||||
base::string16 description;
|
std::u16string description;
|
||||||
|
|
||||||
size_t sep_index = filter.find('|');
|
size_t sep_index = filter.find('|');
|
||||||
if (sep_index != std::string::npos) {
|
if (sep_index != std::string::npos) {
|
||||||
// Treat as a filter of the form "Filter Name|.ext1;.ext2;.ext3".
|
// Treat as a filter of the form "Filter Name|.ext1;.ext2;.ext3".
|
||||||
description = filter.substr(0, sep_index);
|
description = filter.substr(0, sep_index);
|
||||||
|
|
||||||
const std::vector<base::string16>& ext = base::SplitString(
|
const std::vector<std::u16string>& ext =
|
||||||
filter.substr(sep_index + 1), base::ASCIIToUTF16(";"),
|
base::SplitString(filter.substr(sep_index + 1), u";",
|
||||||
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
|
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
|
||||||
for (size_t x = 0; x < ext.size(); ++x) {
|
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] == '.')
|
if (!file_ext.empty() && file_ext[0] == '.')
|
||||||
extensions.push_back(file_ext);
|
extensions.push_back(file_ext);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ void AddFilters(NSPopUpButton* button,
|
||||||
net::GetExtensionsForMimeType(ascii, &ext);
|
net::GetExtensionsForMimeType(ascii, &ext);
|
||||||
if (!ext.empty()) {
|
if (!ext.empty()) {
|
||||||
for (size_t x = 0; x < ext.size(); ++x)
|
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);
|
description = GetDescriptionFromMimeType(ascii);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,22 +92,21 @@ void AddFilters(NSPopUpButton* button,
|
||||||
// will keep growing.
|
// will keep growing.
|
||||||
const size_t kMaxExtensions = 10;
|
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) {
|
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)
|
if (x != 0)
|
||||||
ext_str += base::ASCIIToUTF16(";");
|
ext_str += u";";
|
||||||
ext_str += pattern;
|
ext_str += pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extensions.size() > kMaxExtensions)
|
if (extensions.size() > kMaxExtensions)
|
||||||
ext_str += base::ASCIIToUTF16(";...");
|
ext_str += u";...";
|
||||||
|
|
||||||
if (description.empty()) {
|
if (description.empty()) {
|
||||||
description = ext_str;
|
description = ext_str;
|
||||||
} else {
|
} else {
|
||||||
description +=
|
description += u" (" + ext_str + u")";
|
||||||
base::ASCIIToUTF16(" (") + ext_str + base::ASCIIToUTF16(")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[button addItemWithTitle:base::SysUTF16ToNSString(description)];
|
[button addItemWithTitle:base::SysUTF16ToNSString(description)];
|
||||||
|
@ -119,7 +118,7 @@ void AddFilters(NSPopUpButton* button,
|
||||||
// is implied).
|
// is implied).
|
||||||
if (include_all_files && !all_extensions->empty()) {
|
if (include_all_files && !all_extensions->empty()) {
|
||||||
[button addItemWithTitle:base::SysUTF8ToNSString("All Files (*)")];
|
[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 {
|
@interface CefFilterDelegate : NSObject {
|
||||||
@private
|
@private
|
||||||
NSSavePanel* panel_;
|
NSSavePanel* panel_;
|
||||||
std::vector<std::vector<base::string16>> extensions_;
|
std::vector<std::vector<std::u16string>> extensions_;
|
||||||
int selected_index_;
|
int selected_index_;
|
||||||
}
|
}
|
||||||
- (id)initWithPanel:(NSSavePanel*)panel
|
- (id)initWithPanel:(NSSavePanel*)panel
|
||||||
andAcceptFilters:(const std::vector<base::string16>&)accept_filters
|
andAcceptFilters:(const std::vector<std::u16string>&)accept_filters
|
||||||
andFilterIndex:(int)index;
|
andFilterIndex:(int)index;
|
||||||
- (void)setFilter:(int)index;
|
- (void)setFilter:(int)index;
|
||||||
- (int)filter;
|
- (int)filter;
|
||||||
|
@ -144,7 +143,7 @@ void AddFilters(NSPopUpButton* button,
|
||||||
@implementation CefFilterDelegate
|
@implementation CefFilterDelegate
|
||||||
|
|
||||||
- (id)initWithPanel:(NSSavePanel*)panel
|
- (id)initWithPanel:(NSSavePanel*)panel
|
||||||
andAcceptFilters:(const std::vector<base::string16>&)accept_filters
|
andAcceptFilters:(const std::vector<std::u16string>&)accept_filters
|
||||||
andFilterIndex:(int)index {
|
andFilterIndex:(int)index {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
DCHECK(panel);
|
DCHECK(panel);
|
||||||
|
@ -204,7 +203,7 @@ void AddFilters(NSPopUpButton* button,
|
||||||
|
|
||||||
// Set the extension on the currently selected file name.
|
// Set the extension on the currently selected file name.
|
||||||
- (void)setFileExtension {
|
- (void)setFileExtension {
|
||||||
const std::vector<base::string16>& filter = extensions_[selected_index_];
|
const std::vector<std::u16string>& filter = extensions_[selected_index_];
|
||||||
if (filter.empty()) {
|
if (filter.empty()) {
|
||||||
// All extensions are allowed so don't change anything.
|
// All extensions are allowed so don't change anything.
|
||||||
return;
|
return;
|
||||||
|
@ -214,7 +213,7 @@ void AddFilters(NSPopUpButton* button,
|
||||||
|
|
||||||
// If the file name currently includes an extension from |filter| then don't
|
// If the file name currently includes an extension from |filter| then don't
|
||||||
// change anything.
|
// change anything.
|
||||||
base::string16 extension = base::UTF8ToUTF16(path.Extension());
|
std::u16string extension = base::UTF8ToUTF16(path.Extension());
|
||||||
if (!extension.empty()) {
|
if (!extension.empty()) {
|
||||||
for (size_t i = 0; i < filter.size(); ++i) {
|
for (size_t i = 0; i < filter.size(); ++i) {
|
||||||
if (filter[i] == extension)
|
if (filter[i] == extension)
|
||||||
|
@ -259,7 +258,7 @@ void CefFileDialogRunnerMac::RunOpenFileDialog(
|
||||||
int filter_index) {
|
int filter_index) {
|
||||||
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
|
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
|
||||||
|
|
||||||
base::string16 title;
|
std::u16string title;
|
||||||
if (!params.title.empty()) {
|
if (!params.title.empty()) {
|
||||||
title = params.title;
|
title = params.title;
|
||||||
} else {
|
} else {
|
||||||
|
@ -347,7 +346,7 @@ void CefFileDialogRunnerMac::RunSaveFileDialog(
|
||||||
int filter_index) {
|
int filter_index) {
|
||||||
NSSavePanel* savePanel = [NSSavePanel savePanel];
|
NSSavePanel* savePanel = [NSSavePanel savePanel];
|
||||||
|
|
||||||
base::string16 title;
|
std::u16string title;
|
||||||
if (!params.title.empty())
|
if (!params.title.empty())
|
||||||
title = params.title;
|
title = params.title;
|
||||||
else
|
else
|
||||||
|
|
|
@ -69,8 +69,8 @@ std::wstring FormatFilterForExtensions(
|
||||||
bool include_all_files) {
|
bool include_all_files) {
|
||||||
const std::wstring all_ext = L"*.*";
|
const std::wstring all_ext = L"*.*";
|
||||||
const std::wstring all_desc =
|
const std::wstring all_desc =
|
||||||
l10n_util::GetStringUTF16(IDS_APP_SAVEAS_ALL_FILES) + L" (" + all_ext +
|
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_APP_SAVEAS_ALL_FILES)) +
|
||||||
L")";
|
L" (" + all_ext + L")";
|
||||||
|
|
||||||
DCHECK(file_ext.size() >= ext_desc.size());
|
DCHECK(file_ext.size() >= ext_desc.size());
|
||||||
|
|
||||||
|
@ -97,7 +97,8 @@ std::wstring FormatFilterForExtensions(
|
||||||
ext += L";" + std::wstring(*it);
|
ext += L";" + std::wstring(*it);
|
||||||
}
|
}
|
||||||
std::wstring desc =
|
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(desc.c_str(), desc.size() + 1); // Append NULL too.
|
||||||
result.append(ext.c_str(), ext.size() + 1);
|
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) {
|
for (size_t i = 0; i < base::size(kWildCardMimeTypes); ++i) {
|
||||||
if (mime_type == std::string(kWildCardMimeTypes[i].mime_type) + "/*")
|
if (mime_type == std::string(kWildCardMimeTypes[i].mime_type) + "/*") {
|
||||||
return l10n_util::GetStringUTF16(kWildCardMimeTypes[i].string_id);
|
return base::UTF16ToWide(
|
||||||
|
l10n_util::GetStringUTF16(kWildCardMimeTypes[i].string_id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::wstring();
|
return std::wstring();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring GetFilterString(
|
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> extensions;
|
||||||
std::vector<std::wstring> descriptions;
|
std::vector<std::wstring> descriptions;
|
||||||
|
|
||||||
for (size_t i = 0; i < accept_filters.size(); ++i) {
|
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())
|
if (filter.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
size_t sep_index = filter.find('|');
|
size_t sep_index = filter.find(L'|');
|
||||||
if (sep_index != base::string16::npos) {
|
if (sep_index != std::wstring::npos) {
|
||||||
// Treat as a filter of the form "Filter Name|.ext1;.ext2;.ext3".
|
// Treat as a filter of the form "Filter Name|.ext1;.ext2;.ext3".
|
||||||
const base::string16& desc = filter.substr(0, sep_index);
|
const std::wstring& desc = filter.substr(0, sep_index);
|
||||||
const std::vector<base::string16>& ext = base::SplitString(
|
const std::vector<std::u16string>& ext = base::SplitString(
|
||||||
filter.substr(sep_index + 1), base::ASCIIToUTF16(";"),
|
base::WideToUTF16(filter.substr(sep_index + 1)), u";",
|
||||||
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
|
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
|
||||||
std::wstring ext_str;
|
std::wstring ext_str;
|
||||||
for (size_t x = 0; x < ext.size(); ++x) {
|
for (size_t x = 0; x < ext.size(); ++x) {
|
||||||
const base::string16& file_ext = ext[x];
|
const std::wstring& file_ext = base::UTF16ToWide(ext[x]);
|
||||||
if (!file_ext.empty() && file_ext[0] == '.') {
|
if (!file_ext.empty() && file_ext[0] == L'.') {
|
||||||
if (!ext_str.empty())
|
if (!ext_str.empty())
|
||||||
ext_str += L";";
|
ext_str += L";";
|
||||||
ext_str += L"*" + file_ext;
|
ext_str += L"*" + file_ext;
|
||||||
|
@ -210,7 +213,7 @@ std::wstring GetFilterString(
|
||||||
descriptions.push_back(std::wstring());
|
descriptions.push_back(std::wstring());
|
||||||
} else {
|
} else {
|
||||||
// Otherwise convert mime type to one or more extensions.
|
// 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::vector<base::FilePath::StringType> ext;
|
||||||
std::wstring ext_str;
|
std::wstring ext_str;
|
||||||
net::GetExtensionsForMimeType(ascii, &ext);
|
net::GetExtensionsForMimeType(ascii, &ext);
|
||||||
|
@ -264,10 +267,12 @@ bool RunOpenFileDialog(const CefFileDialogRunner::FileChooserParams& params,
|
||||||
ofn.lpstrInitialDir = directory.c_str();
|
ofn.lpstrInitialDir = directory.c_str();
|
||||||
|
|
||||||
std::wstring title;
|
std::wstring title;
|
||||||
if (!params.title.empty())
|
if (!params.title.empty()) {
|
||||||
title = params.title;
|
title = base::UTF16ToWide(params.title);
|
||||||
else
|
} else {
|
||||||
title = l10n_util::GetStringUTF16(IDS_OPEN_FILE_DIALOG_TITLE);
|
title = base::UTF16ToWide(
|
||||||
|
l10n_util::GetStringUTF16(IDS_OPEN_FILE_DIALOG_TITLE));
|
||||||
|
}
|
||||||
if (!title.empty())
|
if (!title.empty())
|
||||||
ofn.lpstrTitle = title.c_str();
|
ofn.lpstrTitle = title.c_str();
|
||||||
|
|
||||||
|
@ -326,10 +331,12 @@ bool RunOpenMultiFileDialog(
|
||||||
ofn.lpstrInitialDir = directory.c_str();
|
ofn.lpstrInitialDir = directory.c_str();
|
||||||
|
|
||||||
std::wstring title;
|
std::wstring title;
|
||||||
if (!params.title.empty())
|
if (!params.title.empty()) {
|
||||||
title = params.title;
|
title = base::UTF16ToWide(params.title);
|
||||||
else
|
} else {
|
||||||
title = l10n_util::GetStringUTF16(IDS_OPEN_FILES_DIALOG_TITLE);
|
title = base::UTF16ToWide(
|
||||||
|
l10n_util::GetStringUTF16(IDS_OPEN_FILES_DIALOG_TITLE));
|
||||||
|
}
|
||||||
if (!title.empty())
|
if (!title.empty())
|
||||||
ofn.lpstrTitle = title.c_str();
|
ofn.lpstrTitle = title.c_str();
|
||||||
|
|
||||||
|
@ -404,10 +411,12 @@ bool RunOpenFolderDialog(const CefFileDialogRunner::FileChooserParams& params,
|
||||||
browse_info.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
|
browse_info.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
|
||||||
|
|
||||||
std::wstring title;
|
std::wstring title;
|
||||||
if (!params.title.empty())
|
if (!params.title.empty()) {
|
||||||
title = params.title;
|
title = base::UTF16ToWide(params.title);
|
||||||
else
|
} else {
|
||||||
title = l10n_util::GetStringUTF16(IDS_SELECT_FOLDER_DIALOG_TITLE);
|
title = base::UTF16ToWide(
|
||||||
|
l10n_util::GetStringUTF16(IDS_SELECT_FOLDER_DIALOG_TITLE));
|
||||||
|
}
|
||||||
if (!title.empty())
|
if (!title.empty())
|
||||||
browse_info.lpszTitle = title.c_str();
|
browse_info.lpszTitle = title.c_str();
|
||||||
|
|
||||||
|
@ -479,10 +488,12 @@ bool RunSaveFileDialog(const CefFileDialogRunner::FileChooserParams& params,
|
||||||
ofn.lpstrInitialDir = directory.c_str();
|
ofn.lpstrInitialDir = directory.c_str();
|
||||||
|
|
||||||
std::wstring title;
|
std::wstring title;
|
||||||
if (!params.title.empty())
|
if (!params.title.empty()) {
|
||||||
title = params.title;
|
title = base::UTF16ToWide(params.title);
|
||||||
else
|
} else {
|
||||||
title = l10n_util::GetStringUTF16(IDS_SAVE_AS_DIALOG_TITLE);
|
title =
|
||||||
|
base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_SAVE_AS_DIALOG_TITLE));
|
||||||
|
}
|
||||||
if (!title.empty())
|
if (!title.empty())
|
||||||
ofn.lpstrTitle = title.c_str();
|
ofn.lpstrTitle = title.c_str();
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,14 @@ class CefJavaScriptDialogRunnerMac : public CefJavaScriptDialogRunner {
|
||||||
// CefJavaScriptDialogRunner methods:
|
// CefJavaScriptDialogRunner methods:
|
||||||
void Run(AlloyBrowserHostImpl* browser,
|
void Run(AlloyBrowserHostImpl* browser,
|
||||||
content::JavaScriptDialogType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& display_url,
|
const std::u16string& display_url,
|
||||||
const base::string16& message_text,
|
const std::u16string& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const std::u16string& default_prompt_text,
|
||||||
DialogClosedCallback callback) override;
|
DialogClosedCallback callback) override;
|
||||||
void Cancel() override;
|
void Cancel() override;
|
||||||
|
|
||||||
// Callback from CefJavaScriptDialogHelper when the dialog is closed.
|
// 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:
|
private:
|
||||||
DialogClosedCallback callback_;
|
DialogClosedCallback callback_;
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool success = returnCode == NSAlertFirstButtonReturn;
|
bool success = returnCode == NSAlertFirstButtonReturn;
|
||||||
base::string16 input;
|
std::u16string input;
|
||||||
if (textField_)
|
if (textField_)
|
||||||
input = base::SysNSStringToUTF16([textField_ stringValue]);
|
input = base::SysNSStringToUTF16([textField_ stringValue]);
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@ CefJavaScriptDialogRunnerMac::~CefJavaScriptDialogRunnerMac() {
|
||||||
void CefJavaScriptDialogRunnerMac::Run(
|
void CefJavaScriptDialogRunnerMac::Run(
|
||||||
AlloyBrowserHostImpl* browser,
|
AlloyBrowserHostImpl* browser,
|
||||||
content::JavaScriptDialogType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& display_url,
|
const std::u16string& display_url,
|
||||||
const base::string16& message_text,
|
const std::u16string& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const std::u16string& default_prompt_text,
|
||||||
DialogClosedCallback callback) {
|
DialogClosedCallback callback) {
|
||||||
DCHECK(!helper_.get());
|
DCHECK(!helper_.get());
|
||||||
callback_ = std::move(callback);
|
callback_ = std::move(callback);
|
||||||
|
@ -114,20 +114,20 @@ void CefJavaScriptDialogRunnerMac::Run(
|
||||||
[alert setDelegate:helper_];
|
[alert setDelegate:helper_];
|
||||||
[alert setInformativeText:base::SysUTF16ToNSString(message_text)];
|
[alert setInformativeText:base::SysUTF16ToNSString(message_text)];
|
||||||
|
|
||||||
base::string16 label;
|
std::u16string label;
|
||||||
switch (message_type) {
|
switch (message_type) {
|
||||||
case content::JAVASCRIPT_DIALOG_TYPE_ALERT:
|
case content::JAVASCRIPT_DIALOG_TYPE_ALERT:
|
||||||
label = base::ASCIIToUTF16("JavaScript Alert");
|
label = u"JavaScript Alert";
|
||||||
break;
|
break;
|
||||||
case content::JAVASCRIPT_DIALOG_TYPE_PROMPT:
|
case content::JAVASCRIPT_DIALOG_TYPE_PROMPT:
|
||||||
label = base::ASCIIToUTF16("JavaScript Prompt");
|
label = u"JavaScript Prompt";
|
||||||
break;
|
break;
|
||||||
case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM:
|
case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM:
|
||||||
label = base::ASCIIToUTF16("JavaScript Confirm");
|
label = u"JavaScript Confirm";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!display_url.empty())
|
if (!display_url.empty())
|
||||||
label += base::ASCIIToUTF16(" - ") + display_url;
|
label += u" - " + display_url;
|
||||||
|
|
||||||
[alert setMessageText:base::SysUTF16ToNSString(label)];
|
[alert setMessageText:base::SysUTF16ToNSString(label)];
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ void CefJavaScriptDialogRunnerMac::Cancel() {
|
||||||
|
|
||||||
void CefJavaScriptDialogRunnerMac::DialogClosed(
|
void CefJavaScriptDialogRunnerMac::DialogClosed(
|
||||||
bool success,
|
bool success,
|
||||||
const base::string16& user_input) {
|
const std::u16string& user_input) {
|
||||||
helper_.reset(nil);
|
helper_.reset(nil);
|
||||||
std::move(callback_).Run(success, user_input);
|
std::move(callback_).Run(success, user_input);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(HWND dialog,
|
||||||
reinterpret_cast<CefJavaScriptDialogRunnerWin*>(
|
reinterpret_cast<CefJavaScriptDialogRunnerWin*>(
|
||||||
GetWindowLongPtr(dialog, DWLP_USER));
|
GetWindowLongPtr(dialog, DWLP_USER));
|
||||||
if (owner) {
|
if (owner) {
|
||||||
owner->CloseDialog(false, base::string16());
|
owner->CloseDialog(false, std::wstring());
|
||||||
|
|
||||||
// No need for the system to call DestroyWindow() because it will be
|
// No need for the system to call DestroyWindow() because it will be
|
||||||
// called by the Cancel() method.
|
// called by the Cancel() method.
|
||||||
|
@ -51,7 +51,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(HWND dialog,
|
||||||
CefJavaScriptDialogRunnerWin* owner =
|
CefJavaScriptDialogRunnerWin* owner =
|
||||||
reinterpret_cast<CefJavaScriptDialogRunnerWin*>(
|
reinterpret_cast<CefJavaScriptDialogRunnerWin*>(
|
||||||
GetWindowLongPtr(dialog, DWLP_USER));
|
GetWindowLongPtr(dialog, DWLP_USER));
|
||||||
base::string16 user_input;
|
std::wstring user_input;
|
||||||
bool finish = false;
|
bool finish = false;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
switch (LOWORD(wparam)) {
|
switch (LOWORD(wparam)) {
|
||||||
|
@ -62,8 +62,9 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(HWND dialog,
|
||||||
size_t length =
|
size_t length =
|
||||||
GetWindowTextLength(GetDlgItem(dialog, IDC_PROMPTEDIT)) + 1;
|
GetWindowTextLength(GetDlgItem(dialog, IDC_PROMPTEDIT)) + 1;
|
||||||
if (length > 1) {
|
if (length > 1) {
|
||||||
GetDlgItemText(dialog, IDC_PROMPTEDIT,
|
user_input.reserve(length);
|
||||||
base::WriteInto(&user_input, length), length);
|
user_input.resize(length - 1);
|
||||||
|
GetDlgItemText(dialog, IDC_PROMPTEDIT, &user_input[0], length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -93,15 +94,15 @@ CefJavaScriptDialogRunnerWin::~CefJavaScriptDialogRunnerWin() {
|
||||||
void CefJavaScriptDialogRunnerWin::Run(
|
void CefJavaScriptDialogRunnerWin::Run(
|
||||||
AlloyBrowserHostImpl* browser,
|
AlloyBrowserHostImpl* browser,
|
||||||
content::JavaScriptDialogType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& display_url,
|
const std::u16string& display_url,
|
||||||
const base::string16& message_text,
|
const std::u16string& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const std::u16string& default_prompt_text,
|
||||||
DialogClosedCallback callback) {
|
DialogClosedCallback callback) {
|
||||||
DCHECK(!dialog_win_);
|
DCHECK(!dialog_win_);
|
||||||
|
|
||||||
message_type_ = message_type;
|
message_type_ = message_type;
|
||||||
message_text_ = message_text;
|
message_text_ = base::UTF16ToWide(message_text);
|
||||||
default_prompt_text_ = default_prompt_text;
|
default_prompt_text_ = base::UTF16ToWide(default_prompt_text);
|
||||||
callback_ = std::move(callback);
|
callback_ = std::move(callback);
|
||||||
|
|
||||||
InstallMessageHook();
|
InstallMessageHook();
|
||||||
|
@ -135,11 +136,11 @@ void CefJavaScriptDialogRunnerWin::Run(
|
||||||
|
|
||||||
if (!display_url.empty()) {
|
if (!display_url.empty()) {
|
||||||
// Add the display URL to the window title.
|
// Add the display URL to the window title.
|
||||||
TCHAR text[64];
|
wchar_t text[64];
|
||||||
GetWindowText(dialog_win_, text, sizeof(text) / sizeof(TCHAR));
|
GetWindowText(dialog_win_, text, sizeof(text) / sizeof(wchar_t));
|
||||||
|
|
||||||
base::string16 new_window_text =
|
std::wstring new_window_text =
|
||||||
text + base::ASCIIToUTF16(" - ") + display_url;
|
std::wstring(text) + L" - " + base::UTF16ToWide(display_url);
|
||||||
SetWindowText(dialog_win_, new_window_text.c_str());
|
SetWindowText(dialog_win_, new_window_text.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,14 +171,13 @@ void CefJavaScriptDialogRunnerWin::Cancel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefJavaScriptDialogRunnerWin::CloseDialog(
|
void CefJavaScriptDialogRunnerWin::CloseDialog(bool success,
|
||||||
bool success,
|
const std::wstring& user_input) {
|
||||||
const base::string16& user_input) {
|
|
||||||
// Run the callback first so that RenderProcessHostImpl::IsBlocked is
|
// Run the callback first so that RenderProcessHostImpl::IsBlocked is
|
||||||
// cleared. Otherwise, RenderWidgetHostImpl::IsIgnoringInputEvents will
|
// cleared. Otherwise, RenderWidgetHostImpl::IsIgnoringInputEvents will
|
||||||
// return true and RenderWidgetHostViewAura::OnWindowFocused will fail to
|
// return true and RenderWidgetHostViewAura::OnWindowFocused will fail to
|
||||||
// re-assign browser focus.
|
// re-assign browser focus.
|
||||||
std::move(callback_).Run(success, user_input);
|
std::move(callback_).Run(success, base::WideToUTF16(user_input));
|
||||||
Cancel();
|
Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,21 +19,21 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner {
|
||||||
// CefJavaScriptDialogRunner methods:
|
// CefJavaScriptDialogRunner methods:
|
||||||
void Run(AlloyBrowserHostImpl* browser,
|
void Run(AlloyBrowserHostImpl* browser,
|
||||||
content::JavaScriptDialogType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& display_url,
|
const std::u16string& display_url,
|
||||||
const base::string16& message_text,
|
const std::u16string& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const std::u16string& default_prompt_text,
|
||||||
DialogClosedCallback callback) override;
|
DialogClosedCallback callback) override;
|
||||||
void Cancel() override;
|
void Cancel() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CloseDialog(bool success, const base::string16& user_input);
|
void CloseDialog(bool success, const std::wstring& user_input);
|
||||||
|
|
||||||
HWND dialog_win_;
|
HWND dialog_win_;
|
||||||
HWND parent_win_;
|
HWND parent_win_;
|
||||||
|
|
||||||
content::JavaScriptDialogType message_type_;
|
content::JavaScriptDialogType message_type_;
|
||||||
base::string16 message_text_;
|
std::wstring message_text_;
|
||||||
base::string16 default_prompt_text_;
|
std::wstring default_prompt_text_;
|
||||||
DialogClosedCallback callback_;
|
DialogClosedCallback callback_;
|
||||||
|
|
||||||
bool hook_installed_;
|
bool hook_installed_;
|
||||||
|
|
|
@ -37,8 +37,8 @@ void CefMenuRunnerLinux::CancelContextMenu() {
|
||||||
menu_->Cancel();
|
menu_->Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefMenuRunnerLinux::FormatLabel(base::string16& label) {
|
bool CefMenuRunnerLinux::FormatLabel(std::u16string& label) {
|
||||||
// Remove the accelerator indicator (&) from label strings.
|
// Remove the accelerator indicator (&) from label strings.
|
||||||
const base::string16::value_type replace[] = {L'&', 0};
|
const std::u16string::value_type replace[] = {u'&', 0};
|
||||||
return base::ReplaceChars(label, replace, base::string16(), &label);
|
return base::ReplaceChars(label, replace, std::u16string(), &label);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class CefMenuRunnerLinux : public CefMenuRunner {
|
||||||
CefMenuModelImpl* model,
|
CefMenuModelImpl* model,
|
||||||
const content::ContextMenuParams& params) override;
|
const content::ContextMenuParams& params) override;
|
||||||
void CancelContextMenu() override;
|
void CancelContextMenu() override;
|
||||||
bool FormatLabel(base::string16& label) override;
|
bool FormatLabel(std::u16string& label) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<views::MenuRunner> menu_;
|
std::unique_ptr<views::MenuRunner> menu_;
|
||||||
|
|
|
@ -93,7 +93,7 @@ HFONT CreateNativeFont(const gfx::Font& font) {
|
||||||
italic, underline, FALSE, DEFAULT_CHARSET,
|
italic, underline, FALSE, DEFAULT_CHARSET,
|
||||||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||||
DEFAULT_PITCH | FF_DONTCARE,
|
DEFAULT_PITCH | FF_DONTCARE,
|
||||||
base::UTF8ToUTF16(font.GetFontName()).c_str());
|
base::UTF8ToWide(font.GetFontName()).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -102,7 +102,7 @@ struct CefNativeMenuWin::ItemData {
|
||||||
// The Windows API requires that whoever creates the menus must own the
|
// 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
|
// strings used for labels, and keep them around for the lifetime of the
|
||||||
// created menu. So be it.
|
// created menu. So be it.
|
||||||
base::string16 label;
|
std::wstring label;
|
||||||
|
|
||||||
// Someone needs to own submenus, it may as well be us.
|
// Someone needs to own submenus, it may as well be us.
|
||||||
std::unique_ptr<Menu2> submenu;
|
std::unique_ptr<Menu2> submenu;
|
||||||
|
@ -204,14 +204,14 @@ class CefNativeMenuWin::MenuHostWindow {
|
||||||
if (data) {
|
if (data) {
|
||||||
gfx::FontList font_list;
|
gfx::FontList font_list;
|
||||||
measure_item_struct->itemWidth =
|
measure_item_struct->itemWidth =
|
||||||
gfx::GetStringWidth(data->label, font_list) + kIconWidth +
|
gfx::GetStringWidth(base::WideToUTF16(data->label), font_list) +
|
||||||
kItemLeftMargin + kItemLabelSpacing -
|
kIconWidth + kItemLeftMargin + kItemLabelSpacing -
|
||||||
GetSystemMetrics(SM_CXMENUCHECK);
|
GetSystemMetrics(SM_CXMENUCHECK);
|
||||||
if (data->submenu.get())
|
if (data->submenu.get())
|
||||||
measure_item_struct->itemWidth += kArrowWidth;
|
measure_item_struct->itemWidth += kArrowWidth;
|
||||||
// If the label contains an accelerator, make room for tab.
|
// If the label contains an accelerator, make room for tab.
|
||||||
if (data->label.find(L'\t') != base::string16::npos)
|
if (data->label.find(L'\t') != std::wstring::npos)
|
||||||
measure_item_struct->itemWidth += gfx::GetStringWidth(L" ", font_list);
|
measure_item_struct->itemWidth += gfx::GetStringWidth(u" ", font_list);
|
||||||
measure_item_struct->itemHeight =
|
measure_item_struct->itemHeight =
|
||||||
font_list.GetHeight() + kItemBottomMargin + kItemTopMargin;
|
font_list.GetHeight() + kItemBottomMargin + kItemTopMargin;
|
||||||
} else {
|
} else {
|
||||||
|
@ -267,10 +267,10 @@ class CefNativeMenuWin::MenuHostWindow {
|
||||||
// left and the accelerator on the right.
|
// left and the accelerator on the right.
|
||||||
// TODO(jungshik): This will break in RTL UI. Currently, he/ar use the
|
// TODO(jungshik): This will break in RTL UI. Currently, he/ar use the
|
||||||
// window system UI font and will not hit here.
|
// window system UI font and will not hit here.
|
||||||
base::string16 label = data->label;
|
std::wstring label = data->label;
|
||||||
base::string16 accel;
|
std::wstring accel;
|
||||||
base::string16::size_type tab_pos = label.find(L'\t');
|
std::wstring::size_type tab_pos = label.find(L'\t');
|
||||||
if (tab_pos != base::string16::npos) {
|
if (tab_pos != std::wstring::npos) {
|
||||||
accel = label.substr(tab_pos);
|
accel = label.substr(tab_pos);
|
||||||
label = label.substr(0, tab_pos);
|
label = label.substr(0, tab_pos);
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ void CefNativeMenuWin::UpdateStates() {
|
||||||
if (model_->IsItemDynamicAt(model_index)) {
|
if (model_->IsItemDynamicAt(model_index)) {
|
||||||
// TODO(atwilson): Update the icon as well (http://crbug.com/66508).
|
// TODO(atwilson): Update the icon as well (http://crbug.com/66508).
|
||||||
SetMenuItemLabel(menu_index, model_index,
|
SetMenuItemLabel(menu_index, model_index,
|
||||||
model_->GetLabelAt(model_index));
|
base::UTF16ToWide(model_->GetLabelAt(model_index)));
|
||||||
}
|
}
|
||||||
Menu2* submenu = (*it)->submenu.get();
|
Menu2* submenu = (*it)->submenu.get();
|
||||||
if (submenu)
|
if (submenu)
|
||||||
|
@ -643,7 +643,7 @@ void CefNativeMenuWin::AddMenuItemAt(int menu_index, int model_index) {
|
||||||
mii.fType = MFT_OWNERDRAW;
|
mii.fType = MFT_OWNERDRAW;
|
||||||
|
|
||||||
std::unique_ptr<ItemData> item_data = std::make_unique<ItemData>();
|
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);
|
ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
|
||||||
if (type == ui::MenuModel::TYPE_SUBMENU) {
|
if (type == ui::MenuModel::TYPE_SUBMENU) {
|
||||||
item_data->submenu.reset(new Menu2(model_->GetSubmenuModelAt(model_index)));
|
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;
|
item_data->model_index = model_index;
|
||||||
mii.dwItemData = reinterpret_cast<ULONG_PTR>(item_data.get());
|
mii.dwItemData = reinterpret_cast<ULONG_PTR>(item_data.get());
|
||||||
items_.insert(items_.begin() + model_index, std::move(item_data));
|
items_.insert(items_.begin() + model_index, std::move(item_data));
|
||||||
UpdateMenuItemInfoForString(&mii, model_index,
|
UpdateMenuItemInfoForString(
|
||||||
model_->GetLabelAt(model_index));
|
&mii, model_index, base::UTF16ToWide(model_->GetLabelAt(model_index)));
|
||||||
InsertMenuItem(menu_, menu_index, TRUE, &mii);
|
InsertMenuItem(menu_, menu_index, TRUE, &mii);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ void CefNativeMenuWin::SetMenuItemState(int menu_index,
|
||||||
|
|
||||||
void CefNativeMenuWin::SetMenuItemLabel(int menu_index,
|
void CefNativeMenuWin::SetMenuItemLabel(int menu_index,
|
||||||
int model_index,
|
int model_index,
|
||||||
const base::string16& label) {
|
const std::wstring& label) {
|
||||||
if (IsSeparatorItemAt(menu_index))
|
if (IsSeparatorItemAt(menu_index))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -707,11 +707,10 @@ void CefNativeMenuWin::SetMenuItemLabel(int menu_index,
|
||||||
SetMenuItemInfo(menu_, menu_index, MF_BYPOSITION, &mii);
|
SetMenuItemInfo(menu_, menu_index, MF_BYPOSITION, &mii);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefNativeMenuWin::UpdateMenuItemInfoForString(
|
void CefNativeMenuWin::UpdateMenuItemInfoForString(MENUITEMINFO* mii,
|
||||||
MENUITEMINFO* mii,
|
int model_index,
|
||||||
int model_index,
|
const std::wstring& label) {
|
||||||
const base::string16& label) {
|
std::wstring formatted = label;
|
||||||
base::string16 formatted = label;
|
|
||||||
ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
|
ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
|
||||||
// Strip out any tabs, otherwise they get interpreted as accelerators and can
|
// Strip out any tabs, otherwise they get interpreted as accelerators and can
|
||||||
// lead to weird behavior.
|
// lead to weird behavior.
|
||||||
|
@ -721,7 +720,7 @@ void CefNativeMenuWin::UpdateMenuItemInfoForString(
|
||||||
ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE);
|
ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE);
|
||||||
if (model_->GetAcceleratorAt(model_index, &accelerator)) {
|
if (model_->GetAcceleratorAt(model_index, &accelerator)) {
|
||||||
formatted += L"\t";
|
formatted += L"\t";
|
||||||
formatted += accelerator.GetShortcutText();
|
formatted += base::UTF16ToWide(accelerator.GetShortcutText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "base/observer_list.h"
|
#include "base/observer_list.h"
|
||||||
#include "base/strings/string16.h"
|
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
class MenuModel;
|
class MenuModel;
|
||||||
|
@ -73,7 +72,7 @@ class CefNativeMenuWin : public MenuWrapper {
|
||||||
// Sets the label of the item at the specified index.
|
// Sets the label of the item at the specified index.
|
||||||
void SetMenuItemLabel(int menu_index,
|
void SetMenuItemLabel(int menu_index,
|
||||||
int model_index,
|
int model_index,
|
||||||
const base::string16& label);
|
const std::wstring& label);
|
||||||
|
|
||||||
// Updates the local data structure with the correctly formatted version of
|
// Updates the local data structure with the correctly formatted version of
|
||||||
// |label| at the specified model_index, and adds string data to |mii| if
|
// |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.
|
// of the peculiarities of the Windows menu API.
|
||||||
void UpdateMenuItemInfoForString(MENUITEMINFO* mii,
|
void UpdateMenuItemInfoForString(MENUITEMINFO* mii,
|
||||||
int model_index,
|
int model_index,
|
||||||
const base::string16& label);
|
const std::wstring& label);
|
||||||
|
|
||||||
// Returns the alignment flags to be passed to TrackPopupMenuEx, based on the
|
// Returns the alignment flags to be passed to TrackPopupMenuEx, based on the
|
||||||
// supplied alignment and the UI text direction.
|
// supplied alignment and the UI text direction.
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace {
|
||||||
|
|
||||||
base::FilePath FilePathFromASCII(const std::string& str) {
|
base::FilePath FilePathFromASCII(const std::string& str) {
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
return base::FilePath(base::ASCIIToUTF16(str));
|
return base::FilePath(base::ASCIIToWide(str));
|
||||||
#else
|
#else
|
||||||
return base::FilePath(str);
|
return base::FilePath(str);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -206,13 +206,12 @@ class CefBrowserURLRequest::Context
|
||||||
auto browser_context = cef_browser_context->AsBrowserContext();
|
auto browser_context = cef_browser_context->AsBrowserContext();
|
||||||
CHECK(browser_context);
|
CHECK(browser_context);
|
||||||
|
|
||||||
int render_frame_id = MSG_ROUTING_NONE;
|
|
||||||
scoped_refptr<net_service::URLLoaderFactoryGetter> loader_factory_getter;
|
scoped_refptr<net_service::URLLoaderFactoryGetter> loader_factory_getter;
|
||||||
|
|
||||||
// Used to route authentication and certificate callbacks through the
|
// Used to route authentication and certificate callbacks through the
|
||||||
// associated StoragePartition instance.
|
// associated StoragePartition instance.
|
||||||
mojo::PendingRemote<network::mojom::AuthenticationAndCertificateObserver>
|
mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver>
|
||||||
auth_cert_observer;
|
url_loader_network_observer;
|
||||||
|
|
||||||
if (frame) {
|
if (frame) {
|
||||||
// The request will be associated with this frame/browser if it's valid,
|
// The request will be associated with this frame/browser if it's valid,
|
||||||
|
@ -220,23 +219,16 @@ class CefBrowserURLRequest::Context
|
||||||
content::RenderFrameHost* rfh =
|
content::RenderFrameHost* rfh =
|
||||||
static_cast<CefFrameHostImpl*>(frame.get())->GetRenderFrameHost();
|
static_cast<CefFrameHostImpl*>(frame.get())->GetRenderFrameHost();
|
||||||
if (rfh) {
|
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 =
|
loader_factory_getter =
|
||||||
net_service::URLLoaderFactoryGetter::Create(rfh, browser_context);
|
net_service::URLLoaderFactoryGetter::Create(rfh, browser_context);
|
||||||
auth_cert_observer = static_cast<content::RenderFrameHostImpl*>(rfh)
|
url_loader_network_observer =
|
||||||
->CreateAuthAndCertObserver();
|
static_cast<content::RenderFrameHostImpl*>(rfh)
|
||||||
|
->CreateURLLoaderNetworkObserver();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
loader_factory_getter =
|
loader_factory_getter =
|
||||||
net_service::URLLoaderFactoryGetter::Create(nullptr, browser_context);
|
net_service::URLLoaderFactoryGetter::Create(nullptr, browser_context);
|
||||||
auth_cert_observer =
|
url_loader_network_observer =
|
||||||
static_cast<content::StoragePartitionImpl*>(
|
static_cast<content::StoragePartitionImpl*>(
|
||||||
content::BrowserContext::GetDefaultStoragePartition(
|
content::BrowserContext::GetDefaultStoragePartition(
|
||||||
browser_context))
|
browser_context))
|
||||||
|
@ -247,16 +239,15 @@ class CefBrowserURLRequest::Context
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::BindOnce(
|
base::BindOnce(
|
||||||
&CefBrowserURLRequest::Context::ContinueOnOriginatingThread, self,
|
&CefBrowserURLRequest::Context::ContinueOnOriginatingThread, self,
|
||||||
render_frame_id, MakeRequestID(), loader_factory_getter,
|
MakeRequestID(), loader_factory_getter,
|
||||||
std::move(auth_cert_observer)));
|
std::move(url_loader_network_observer)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContinueOnOriginatingThread(
|
void ContinueOnOriginatingThread(
|
||||||
int render_frame_id,
|
|
||||||
int32_t request_id,
|
int32_t request_id,
|
||||||
scoped_refptr<net_service::URLLoaderFactoryGetter> loader_factory_getter,
|
scoped_refptr<net_service::URLLoaderFactoryGetter> loader_factory_getter,
|
||||||
mojo::PendingRemote<network::mojom::AuthenticationAndCertificateObserver>
|
mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver>
|
||||||
auth_cert_observer) {
|
url_loader_network_observer) {
|
||||||
DCHECK(CalledOnValidThread());
|
DCHECK(CalledOnValidThread());
|
||||||
|
|
||||||
// The request may have been canceled.
|
// The request may have been canceled.
|
||||||
|
@ -282,8 +273,6 @@ class CefBrowserURLRequest::Context
|
||||||
static_cast<CefRequestImpl*>(request_.get())
|
static_cast<CefRequestImpl*>(request_.get())
|
||||||
->Get(resource_request.get(), false);
|
->Get(resource_request.get(), false);
|
||||||
|
|
||||||
resource_request->render_frame_id = render_frame_id;
|
|
||||||
|
|
||||||
// Behave the same as a subresource load.
|
// Behave the same as a subresource load.
|
||||||
resource_request->resource_type =
|
resource_request->resource_type =
|
||||||
static_cast<int>(blink::mojom::ResourceType::kSubResource);
|
static_cast<int>(blink::mojom::ResourceType::kSubResource);
|
||||||
|
@ -298,11 +287,11 @@ class CefBrowserURLRequest::Context
|
||||||
net::SiteForCookies::FromOrigin(*resource_request->request_initiator);
|
net::SiteForCookies::FromOrigin(*resource_request->request_initiator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth_cert_observer) {
|
if (url_loader_network_observer) {
|
||||||
resource_request->trusted_params =
|
resource_request->trusted_params =
|
||||||
network::ResourceRequest::TrustedParams();
|
network::ResourceRequest::TrustedParams();
|
||||||
resource_request->trusted_params->auth_cert_observer =
|
resource_request->trusted_params->url_loader_network_observer =
|
||||||
std::move(auth_cert_observer);
|
std::move(url_loader_network_observer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SimpleURLLoader is picky about the body contents. Try to populate them
|
// SimpleURLLoader is picky about the body contents. Try to populate them
|
||||||
|
|
|
@ -46,7 +46,7 @@ net::CookieOptions GetCookieOptions(const network::ResourceRequest& request) {
|
||||||
options.set_include_httponly();
|
options.set_include_httponly();
|
||||||
options.set_same_site_cookie_context(
|
options.set_same_site_cookie_context(
|
||||||
net::cookie_util::ComputeSameSiteContextForRequest(
|
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,
|
request.request_initiator, is_main_frame_navigation,
|
||||||
should_treat_as_first_party));
|
should_treat_as_first_party));
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||||
public:
|
public:
|
||||||
InterceptedRequest(
|
InterceptedRequest(
|
||||||
ProxyURLLoaderFactory* factory,
|
ProxyURLLoaderFactory* factory,
|
||||||
RequestId id,
|
int32_t id,
|
||||||
uint32_t options,
|
uint32_t options,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
|
@ -207,6 +207,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||||
OnHeadersReceivedCallback callback) override;
|
OnHeadersReceivedCallback callback) override;
|
||||||
|
|
||||||
// mojom::URLLoaderClient methods:
|
// mojom::URLLoaderClient methods:
|
||||||
|
void OnReceiveEarlyHints(network::mojom::EarlyHintsPtr early_hints) override;
|
||||||
void OnReceiveResponse(network::mojom::URLResponseHeadPtr head) override;
|
void OnReceiveResponse(network::mojom::URLResponseHeadPtr head) override;
|
||||||
void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
|
void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
|
||||||
network::mojom::URLResponseHeadPtr head) override;
|
network::mojom::URLResponseHeadPtr head) override;
|
||||||
|
@ -230,7 +231,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||||
void PauseReadingBodyFromNet() override;
|
void PauseReadingBodyFromNet() override;
|
||||||
void ResumeReadingBodyFromNet() override;
|
void ResumeReadingBodyFromNet() override;
|
||||||
|
|
||||||
const RequestId id() const { return id_; }
|
int32_t id() const { return id_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Helpers for determining the request handler.
|
// Helpers for determining the request handler.
|
||||||
|
@ -289,7 +290,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||||
void OnUploadProgressACK();
|
void OnUploadProgressACK();
|
||||||
|
|
||||||
ProxyURLLoaderFactory* const factory_;
|
ProxyURLLoaderFactory* const factory_;
|
||||||
const RequestId id_;
|
const int32_t id_;
|
||||||
const uint32_t options_;
|
const uint32_t options_;
|
||||||
bool input_stream_previously_failed_ = false;
|
bool input_stream_previously_failed_ = false;
|
||||||
bool request_was_redirected_ = false;
|
bool request_was_redirected_ = false;
|
||||||
|
@ -346,19 +347,18 @@ class InterceptDelegate : public StreamReaderURLLoader::Delegate {
|
||||||
base::WeakPtr<InterceptedRequest> request)
|
base::WeakPtr<InterceptedRequest> request)
|
||||||
: response_(std::move(response)), request_(request) {}
|
: response_(std::move(response)), request_(request) {}
|
||||||
|
|
||||||
bool OpenInputStream(const RequestId& request_id,
|
bool OpenInputStream(int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
OpenCallback callback) override {
|
OpenCallback callback) override {
|
||||||
return response_->OpenInputStream(request_id, request, std::move(callback));
|
return response_->OpenInputStream(request_id, request, std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnInputStreamOpenFailed(const RequestId& request_id,
|
void OnInputStreamOpenFailed(int32_t request_id, bool* restarted) override {
|
||||||
bool* restarted) override {
|
|
||||||
request_->InputStreamFailed(false /* restart_needed */);
|
request_->InputStreamFailed(false /* restart_needed */);
|
||||||
*restarted = false;
|
*restarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetResponseHeaders(const RequestId& request_id,
|
void GetResponseHeaders(int32_t request_id,
|
||||||
int* status_code,
|
int* status_code,
|
||||||
std::string* reason_phrase,
|
std::string* reason_phrase,
|
||||||
std::string* mime_type,
|
std::string* mime_type,
|
||||||
|
@ -377,7 +377,7 @@ class InterceptDelegate : public StreamReaderURLLoader::Delegate {
|
||||||
|
|
||||||
InterceptedRequest::InterceptedRequest(
|
InterceptedRequest::InterceptedRequest(
|
||||||
ProxyURLLoaderFactory* factory,
|
ProxyURLLoaderFactory* factory,
|
||||||
RequestId id,
|
int32_t id,
|
||||||
uint32_t options,
|
uint32_t options,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
||||||
|
@ -533,6 +533,11 @@ void InterceptedRequest::OnHeadersReceived(
|
||||||
|
|
||||||
// URLLoaderClient methods.
|
// URLLoaderClient methods.
|
||||||
|
|
||||||
|
void InterceptedRequest::OnReceiveEarlyHints(
|
||||||
|
network::mojom::EarlyHintsPtr early_hints) {
|
||||||
|
target_client_->OnReceiveEarlyHints(std::move(early_hints));
|
||||||
|
}
|
||||||
|
|
||||||
void InterceptedRequest::OnReceiveResponse(
|
void InterceptedRequest::OnReceiveResponse(
|
||||||
network::mojom::URLResponseHeadPtr head) {
|
network::mojom::URLResponseHeadPtr head) {
|
||||||
current_response_ = std::move(head);
|
current_response_ = std::move(head);
|
||||||
|
@ -776,8 +781,7 @@ void InterceptedRequest::ContinueAfterIntercept() {
|
||||||
// might, so we need to set the option on the loader.
|
// might, so we need to set the option on the loader.
|
||||||
uint32_t options = options_ | network::mojom::kURLLoadOptionUseHeaderClient;
|
uint32_t options = options_ | network::mojom::kURLLoadOptionUseHeaderClient;
|
||||||
target_factory_->CreateLoaderAndStart(
|
target_factory_->CreateLoaderAndStart(
|
||||||
target_loader_.BindNewPipeAndPassReceiver(), id_.routing_id(),
|
target_loader_.BindNewPipeAndPassReceiver(), id_, options, request_,
|
||||||
id_.request_id(), options, request_,
|
|
||||||
proxied_client_receiver_.BindNewPipeAndPassRemote(),
|
proxied_client_receiver_.BindNewPipeAndPassRemote(),
|
||||||
traffic_annotation_);
|
traffic_annotation_);
|
||||||
}
|
}
|
||||||
|
@ -1141,7 +1145,7 @@ InterceptedRequestHandler::InterceptedRequestHandler() {}
|
||||||
InterceptedRequestHandler::~InterceptedRequestHandler() {}
|
InterceptedRequestHandler::~InterceptedRequestHandler() {}
|
||||||
|
|
||||||
void InterceptedRequestHandler::OnBeforeRequest(
|
void InterceptedRequestHandler::OnBeforeRequest(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
bool request_was_redirected,
|
bool request_was_redirected,
|
||||||
OnBeforeRequestResultCallback callback,
|
OnBeforeRequestResultCallback callback,
|
||||||
|
@ -1150,14 +1154,14 @@ void InterceptedRequestHandler::OnBeforeRequest(
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterceptedRequestHandler::ShouldInterceptRequest(
|
void InterceptedRequestHandler::ShouldInterceptRequest(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
ShouldInterceptRequestResultCallback callback) {
|
ShouldInterceptRequestResultCallback callback) {
|
||||||
std::move(callback).Run(nullptr);
|
std::move(callback).Run(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterceptedRequestHandler::OnRequestResponse(
|
void InterceptedRequestHandler::OnRequestResponse(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
net::HttpResponseHeaders* headers,
|
net::HttpResponseHeaders* headers,
|
||||||
base::Optional<net::RedirectInfo> redirect_info,
|
base::Optional<net::RedirectInfo> redirect_info,
|
||||||
|
@ -1169,7 +1173,7 @@ void InterceptedRequestHandler::OnRequestResponse(
|
||||||
|
|
||||||
mojo::ScopedDataPipeConsumerHandle
|
mojo::ScopedDataPipeConsumerHandle
|
||||||
InterceptedRequestHandler::OnFilterResponseBody(
|
InterceptedRequestHandler::OnFilterResponseBody(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
mojo::ScopedDataPipeConsumerHandle body) {
|
mojo::ScopedDataPipeConsumerHandle body) {
|
||||||
return body;
|
return body;
|
||||||
|
@ -1287,7 +1291,6 @@ void ProxyURLLoaderFactory::CreateProxy(
|
||||||
|
|
||||||
void ProxyURLLoaderFactory::CreateLoaderAndStart(
|
void ProxyURLLoaderFactory::CreateLoaderAndStart(
|
||||||
mojo::PendingReceiver<network::mojom::URLLoader> receiver,
|
mojo::PendingReceiver<network::mojom::URLLoader> receiver,
|
||||||
int32_t routing_id,
|
|
||||||
int32_t request_id,
|
int32_t request_id,
|
||||||
uint32_t options,
|
uint32_t options,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
|
@ -1303,9 +1306,9 @@ void ProxyURLLoaderFactory::CreateLoaderAndStart(
|
||||||
if (pass_through) {
|
if (pass_through) {
|
||||||
// This is the so-called pass-through, no-op option.
|
// This is the so-called pass-through, no-op option.
|
||||||
if (target_factory_) {
|
if (target_factory_) {
|
||||||
target_factory_->CreateLoaderAndStart(
|
target_factory_->CreateLoaderAndStart(std::move(receiver), request_id,
|
||||||
std::move(receiver), routing_id, request_id, options, request,
|
options, request, std::move(client),
|
||||||
std::move(client), traffic_annotation);
|
traffic_annotation);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1317,9 +1320,8 @@ void ProxyURLLoaderFactory::CreateLoaderAndStart(
|
||||||
}
|
}
|
||||||
|
|
||||||
InterceptedRequest* req = new InterceptedRequest(
|
InterceptedRequest* req = new InterceptedRequest(
|
||||||
this, RequestId(request_id, routing_id), options, request,
|
this, request_id, options, request, traffic_annotation,
|
||||||
traffic_annotation, std::move(receiver), std::move(client),
|
std::move(receiver), std::move(client), std::move(target_factory_clone));
|
||||||
std::move(target_factory_clone));
|
|
||||||
requests_.insert(std::make_pair(request_id, base::WrapUnique(req)));
|
requests_.insert(std::make_pair(request_id, base::WrapUnique(req)));
|
||||||
req->Restart();
|
req->Restart();
|
||||||
}
|
}
|
||||||
|
@ -1362,7 +1364,7 @@ void ProxyURLLoaderFactory::OnProxyBindingError() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxyURLLoaderFactory::RemoveRequest(InterceptedRequest* request) {
|
void ProxyURLLoaderFactory::RemoveRequest(InterceptedRequest* request) {
|
||||||
auto it = requests_.find(request->id().request_id());
|
auto it = requests_.find(request->id());
|
||||||
DCHECK(it != requests_.end());
|
DCHECK(it != requests_.end());
|
||||||
requests_.erase(it);
|
requests_.erase(it);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class InterceptedRequestHandler {
|
||||||
base::OnceCallback<void(bool /* intercept_request */,
|
base::OnceCallback<void(bool /* intercept_request */,
|
||||||
bool /* intercept_only */)>;
|
bool /* intercept_only */)>;
|
||||||
using CancelRequestCallback = base::OnceCallback<void(int /* error_code */)>;
|
using CancelRequestCallback = base::OnceCallback<void(int /* error_code */)>;
|
||||||
virtual void OnBeforeRequest(const RequestId& id,
|
virtual void OnBeforeRequest(int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
bool request_was_redirected,
|
bool request_was_redirected,
|
||||||
OnBeforeRequestResultCallback callback,
|
OnBeforeRequestResultCallback callback,
|
||||||
|
@ -57,7 +57,7 @@ class InterceptedRequestHandler {
|
||||||
using ShouldInterceptRequestResultCallback =
|
using ShouldInterceptRequestResultCallback =
|
||||||
base::OnceCallback<void(std::unique_ptr<ResourceResponse>)>;
|
base::OnceCallback<void(std::unique_ptr<ResourceResponse>)>;
|
||||||
virtual void ShouldInterceptRequest(
|
virtual void ShouldInterceptRequest(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
ShouldInterceptRequestResultCallback callback);
|
ShouldInterceptRequestResultCallback callback);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class InterceptedRequestHandler {
|
||||||
// values will be merged first, and then any |removed_headers| values will be
|
// values will be merged first, and then any |removed_headers| values will be
|
||||||
// removed. This comparison is case sensitive.
|
// removed. This comparison is case sensitive.
|
||||||
virtual void ProcessRequestHeaders(
|
virtual void ProcessRequestHeaders(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
const GURL& redirect_url,
|
const GURL& redirect_url,
|
||||||
net::HttpRequestHeaders* modified_headers,
|
net::HttpRequestHeaders* modified_headers,
|
||||||
|
@ -79,7 +79,7 @@ class InterceptedRequestHandler {
|
||||||
// method is called in response to a redirect. Even though |head| is const the
|
// 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
|
// |head.headers| value is non-const and any changes will be passed to the
|
||||||
// client.
|
// client.
|
||||||
virtual void ProcessResponseHeaders(const RequestId& id,
|
virtual void ProcessResponseHeaders(int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
const GURL& redirect_url,
|
const GURL& redirect_url,
|
||||||
net::HttpResponseHeaders* headers) {}
|
net::HttpResponseHeaders* headers) {}
|
||||||
|
@ -101,7 +101,7 @@ class InterceptedRequestHandler {
|
||||||
scoped_refptr<net::HttpResponseHeaders> /* override_headers */,
|
scoped_refptr<net::HttpResponseHeaders> /* override_headers */,
|
||||||
const GURL& /* redirect_url */)>;
|
const GURL& /* redirect_url */)>;
|
||||||
virtual void OnRequestResponse(
|
virtual void OnRequestResponse(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
net::HttpResponseHeaders* headers,
|
net::HttpResponseHeaders* headers,
|
||||||
base::Optional<net::RedirectInfo> redirect_info,
|
base::Optional<net::RedirectInfo> redirect_info,
|
||||||
|
@ -109,18 +109,18 @@ class InterceptedRequestHandler {
|
||||||
|
|
||||||
// Called to optionally filter the response body.
|
// Called to optionally filter the response body.
|
||||||
virtual mojo::ScopedDataPipeConsumerHandle OnFilterResponseBody(
|
virtual mojo::ScopedDataPipeConsumerHandle OnFilterResponseBody(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
mojo::ScopedDataPipeConsumerHandle body);
|
mojo::ScopedDataPipeConsumerHandle body);
|
||||||
|
|
||||||
// Called on completion notification from the loader (successful or not).
|
// Called on completion notification from the loader (successful or not).
|
||||||
virtual void OnRequestComplete(
|
virtual void OnRequestComplete(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
const network::URLLoaderCompletionStatus& status) {}
|
const network::URLLoaderCompletionStatus& status) {}
|
||||||
|
|
||||||
// Called on error.
|
// Called on error.
|
||||||
virtual void OnRequestError(const RequestId& id,
|
virtual void OnRequestError(int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
int error_code,
|
int error_code,
|
||||||
bool safebrowsing_hit) {}
|
bool safebrowsing_hit) {}
|
||||||
|
@ -156,7 +156,6 @@ class ProxyURLLoaderFactory
|
||||||
// mojom::URLLoaderFactory methods:
|
// mojom::URLLoaderFactory methods:
|
||||||
void CreateLoaderAndStart(
|
void CreateLoaderAndStart(
|
||||||
mojo::PendingReceiver<network::mojom::URLLoader> receiver,
|
mojo::PendingReceiver<network::mojom::URLLoader> receiver,
|
||||||
int32_t routing_id,
|
|
||||||
int32_t request_id,
|
int32_t request_id,
|
||||||
uint32_t options,
|
uint32_t options,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
|
|
|
@ -372,7 +372,7 @@ void CallProcessRequestOnIOThread(
|
||||||
|
|
||||||
class ResourceResponseWrapper : public ResourceResponse {
|
class ResourceResponseWrapper : public ResourceResponse {
|
||||||
public:
|
public:
|
||||||
ResourceResponseWrapper(const RequestId request_id,
|
ResourceResponseWrapper(const int32_t request_id,
|
||||||
CefRefPtr<CefResourceHandler> handler)
|
CefRefPtr<CefResourceHandler> handler)
|
||||||
: request_id_(request_id),
|
: request_id_(request_id),
|
||||||
handler_provider_(new HandlerProvider(handler)) {}
|
handler_provider_(new HandlerProvider(handler)) {}
|
||||||
|
@ -383,7 +383,7 @@ class ResourceResponseWrapper : public ResourceResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceResponse methods:
|
// ResourceResponse methods:
|
||||||
bool OpenInputStream(const RequestId& request_id,
|
bool OpenInputStream(int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
OpenCallback callback) override {
|
OpenCallback callback) override {
|
||||||
DCHECK_EQ(request_id, request_id_);
|
DCHECK_EQ(request_id, request_id_);
|
||||||
|
@ -396,7 +396,7 @@ class ResourceResponseWrapper : public ResourceResponse {
|
||||||
|
|
||||||
// May be recreated on redirect.
|
// May be recreated on redirect.
|
||||||
request_ = new CefRequestImpl();
|
request_ = new CefRequestImpl();
|
||||||
request_->Set(&request, request_id.hash());
|
request_->Set(&request, request_id);
|
||||||
request_->SetReadOnly(true);
|
request_->SetReadOnly(true);
|
||||||
|
|
||||||
CefRefPtr<OpenCallbackWrapper> callbackWrapper = new OpenCallbackWrapper(
|
CefRefPtr<OpenCallbackWrapper> callbackWrapper = new OpenCallbackWrapper(
|
||||||
|
@ -426,7 +426,7 @@ class ResourceResponseWrapper : public ResourceResponse {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetResponseHeaders(const RequestId& request_id,
|
void GetResponseHeaders(int32_t request_id,
|
||||||
int* status_code,
|
int* status_code,
|
||||||
std::string* reason_phrase,
|
std::string* reason_phrase,
|
||||||
std::string* mime_type,
|
std::string* mime_type,
|
||||||
|
@ -487,7 +487,7 @@ class ResourceResponseWrapper : public ResourceResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const RequestId request_id_;
|
const int32_t request_id_;
|
||||||
|
|
||||||
CefRefPtr<CefRequestImpl> request_;
|
CefRefPtr<CefRequestImpl> request_;
|
||||||
scoped_refptr<HandlerProvider> handler_provider_;
|
scoped_refptr<HandlerProvider> handler_provider_;
|
||||||
|
@ -498,7 +498,7 @@ class ResourceResponseWrapper : public ResourceResponse {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::unique_ptr<ResourceResponse> CreateResourceResponse(
|
std::unique_ptr<ResourceResponse> CreateResourceResponse(
|
||||||
const RequestId& request_id,
|
int32_t request_id,
|
||||||
CefRefPtr<CefResourceHandler> handler) {
|
CefRefPtr<CefResourceHandler> handler) {
|
||||||
return std::make_unique<ResourceResponseWrapper>(request_id, handler);
|
return std::make_unique<ResourceResponseWrapper>(request_id, handler);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,13 @@
|
||||||
|
|
||||||
namespace net_service {
|
namespace net_service {
|
||||||
|
|
||||||
class RequestId;
|
|
||||||
class ResourceResponse;
|
class ResourceResponse;
|
||||||
|
|
||||||
// Create a ResourceResponse that delegates to |handler|.
|
// Create a ResourceResponse that delegates to |handler|.
|
||||||
// The resulting object should be passed to
|
// The resulting object should be passed to
|
||||||
// InterceptedRequestHandler::ShouldInterceptRequestResultCallback.
|
// InterceptedRequestHandler::ShouldInterceptRequestResultCallback.
|
||||||
std::unique_ptr<ResourceResponse> CreateResourceResponse(
|
std::unique_ptr<ResourceResponse> CreateResourceResponse(
|
||||||
const RequestId& request_id,
|
int32_t request_id,
|
||||||
CefRefPtr<CefResourceHandler> handler);
|
CefRefPtr<CefResourceHandler> handler);
|
||||||
|
|
||||||
} // namespace net_service
|
} // namespace net_service
|
||||||
|
|
|
@ -131,12 +131,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PendingRequest {
|
struct PendingRequest {
|
||||||
PendingRequest(const RequestId& id,
|
PendingRequest(int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
bool request_was_redirected,
|
bool request_was_redirected,
|
||||||
OnBeforeRequestResultCallback callback,
|
OnBeforeRequestResultCallback callback,
|
||||||
CancelRequestCallback cancel_callback)
|
CancelRequestCallback cancel_callback)
|
||||||
: id_(id),
|
: id_(request_id),
|
||||||
request_(request),
|
request_(request),
|
||||||
request_was_redirected_(request_was_redirected),
|
request_was_redirected_(request_was_redirected),
|
||||||
callback_(std::move(callback)),
|
callback_(std::move(callback)),
|
||||||
|
@ -153,7 +153,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
std::move(callback_), std::move(cancel_callback_));
|
std::move(callback_), std::move(cancel_callback_));
|
||||||
}
|
}
|
||||||
|
|
||||||
const RequestId id_;
|
const int32_t id_;
|
||||||
network::ResourceRequest* const request_;
|
network::ResourceRequest* const request_;
|
||||||
const bool request_was_redirected_;
|
const bool request_was_redirected_;
|
||||||
OnBeforeRequestResultCallback callback_;
|
OnBeforeRequestResultCallback callback_;
|
||||||
|
@ -251,7 +251,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
CefRefPtr<CefBrowserHostBase> browser,
|
CefRefPtr<CefBrowserHostBase> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
int render_process_id,
|
int render_process_id,
|
||||||
int render_frame_id,
|
|
||||||
int frame_tree_node_id,
|
int frame_tree_node_id,
|
||||||
bool is_navigation,
|
bool is_navigation,
|
||||||
bool is_download,
|
bool is_download,
|
||||||
|
@ -280,7 +279,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
render_process_id_ = render_process_id;
|
render_process_id_ = render_process_id;
|
||||||
render_frame_id_ = render_frame_id;
|
|
||||||
frame_tree_node_id_ = frame_tree_node_id;
|
frame_tree_node_id_ = frame_tree_node_id;
|
||||||
is_navigation_ = is_navigation;
|
is_navigation_ = is_navigation;
|
||||||
is_download_ = is_download;
|
is_download_ = is_download;
|
||||||
|
@ -317,7 +315,6 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
scoped_refptr<CefIOThreadState> iothread_state_;
|
scoped_refptr<CefIOThreadState> iothread_state_;
|
||||||
CefBrowserContext::CookieableSchemes cookieable_schemes_;
|
CefBrowserContext::CookieableSchemes cookieable_schemes_;
|
||||||
int render_process_id_ = 0;
|
int render_process_id_ = 0;
|
||||||
int render_frame_id_ = -1;
|
|
||||||
int frame_tree_node_id_ = -1;
|
int frame_tree_node_id_ = -1;
|
||||||
bool is_navigation_ = true;
|
bool is_navigation_ = true;
|
||||||
bool is_download_ = false;
|
bool is_download_ = false;
|
||||||
|
@ -413,7 +410,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// InterceptedRequestHandler methods:
|
// InterceptedRequestHandler methods:
|
||||||
void OnBeforeRequest(const RequestId& id,
|
void OnBeforeRequest(int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
bool request_was_redirected,
|
bool request_was_redirected,
|
||||||
OnBeforeRequestResultCallback callback,
|
OnBeforeRequestResultCallback callback,
|
||||||
|
@ -429,13 +426,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
if (!init_state_) {
|
if (!init_state_) {
|
||||||
// Queue requests until we're initialized.
|
// Queue requests until we're initialized.
|
||||||
pending_requests_.push_back(std::make_unique<PendingRequest>(
|
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)));
|
std::move(cancel_callback)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// State may already exist for restarted requests.
|
// State may already exist for restarted requests.
|
||||||
RequestState* state = GetOrCreateState(id);
|
RequestState* state = GetOrCreateState(request_id);
|
||||||
|
|
||||||
// Add standard headers, if currently unspecified.
|
// Add standard headers, if currently unspecified.
|
||||||
request->headers.SetHeaderIfMissing(
|
request->headers.SetHeaderIfMissing(
|
||||||
|
@ -451,12 +448,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
|
|
||||||
CefRefPtr<CefRequestImpl> requestPtr;
|
CefRefPtr<CefRequestImpl> requestPtr;
|
||||||
CefRefPtr<CefResourceRequestHandler> handler =
|
CefRefPtr<CefResourceRequestHandler> handler =
|
||||||
GetHandler(id, request, &intercept_only, requestPtr);
|
GetHandler(request_id, request, &intercept_only, requestPtr);
|
||||||
|
|
||||||
CefRefPtr<CefSchemeHandlerFactory> scheme_factory =
|
CefRefPtr<CefSchemeHandlerFactory> scheme_factory =
|
||||||
init_state_->iothread_state_->GetSchemeHandlerFactory(request->url);
|
init_state_->iothread_state_->GetSchemeHandlerFactory(request->url);
|
||||||
if (scheme_factory && !requestPtr) {
|
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.
|
// True if there's a possibility that the client might handle the request.
|
||||||
|
@ -483,10 +480,10 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
return;
|
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,
|
RequestState* state,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
base::OnceClosure callback) {
|
base::OnceClosure callback) {
|
||||||
|
@ -505,12 +502,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
state->cookie_filter_
|
state->cookie_filter_
|
||||||
? base::BindRepeating(
|
? base::BindRepeating(
|
||||||
&InterceptedRequestHandlerWrapper::AllowCookieLoad,
|
&InterceptedRequestHandlerWrapper::AllowCookieLoad,
|
||||||
weak_ptr_factory_.GetWeakPtr(), id)
|
weak_ptr_factory_.GetWeakPtr(), request_id)
|
||||||
: base::BindRepeating(
|
: base::BindRepeating(
|
||||||
&InterceptedRequestHandlerWrapper::AllowCookieAlways);
|
&InterceptedRequestHandlerWrapper::AllowCookieAlways);
|
||||||
auto done_cookie_callback = base::BindOnce(
|
auto done_cookie_callback = base::BindOnce(
|
||||||
&InterceptedRequestHandlerWrapper::ContinueWithLoadedCookies,
|
&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,
|
cookie_helper::LoadCookies(init_state_->browser_context_, *request,
|
||||||
allow_cookie_callback,
|
allow_cookie_callback,
|
||||||
std::move(done_cookie_callback));
|
std::move(done_cookie_callback));
|
||||||
|
@ -521,12 +519,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
*allow = true;
|
*allow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AllowCookieLoad(const RequestId& id,
|
void AllowCookieLoad(int32_t request_id,
|
||||||
const net::CanonicalCookie& cookie,
|
const net::CanonicalCookie& cookie,
|
||||||
bool* allow) {
|
bool* allow) {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// The request may have been canceled while the async callback was
|
// The request may have been canceled while the async callback was
|
||||||
// pending.
|
// pending.
|
||||||
|
@ -543,14 +541,14 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContinueWithLoadedCookies(const RequestId& id,
|
void ContinueWithLoadedCookies(int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
base::OnceClosure callback,
|
base::OnceClosure callback,
|
||||||
int total_count,
|
int total_count,
|
||||||
net::CookieList allowed_cookies) {
|
net::CookieList allowed_cookies) {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// The request may have been canceled while the async callback was
|
// The request may have been canceled while the async callback was
|
||||||
// pending.
|
// pending.
|
||||||
|
@ -579,12 +577,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShouldInterceptRequest(
|
void ShouldInterceptRequest(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
ShouldInterceptRequestResultCallback callback) override {
|
ShouldInterceptRequestResultCallback callback) override {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// The request may have been canceled during destruction.
|
// The request may have been canceled during destruction.
|
||||||
return;
|
return;
|
||||||
|
@ -603,8 +601,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
CefRefPtr<RequestCallbackWrapper> callbackPtr =
|
CefRefPtr<RequestCallbackWrapper> callbackPtr =
|
||||||
new RequestCallbackWrapper(base::BindOnce(
|
new RequestCallbackWrapper(base::BindOnce(
|
||||||
&InterceptedRequestHandlerWrapper::ContinueShouldInterceptRequest,
|
&InterceptedRequestHandlerWrapper::ContinueShouldInterceptRequest,
|
||||||
weak_ptr_factory_.GetWeakPtr(), id, base::Unretained(request),
|
weak_ptr_factory_.GetWeakPtr(), request_id,
|
||||||
std::move(callback)));
|
base::Unretained(request), std::move(callback)));
|
||||||
|
|
||||||
cef_return_value_t retval = state->handler_->OnBeforeResourceLoad(
|
cef_return_value_t retval = state->handler_->OnBeforeResourceLoad(
|
||||||
init_state_->browser_, init_state_->frame_,
|
init_state_->browser_, init_state_->frame_,
|
||||||
|
@ -615,18 +613,19 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The scheme factory may choose to handle it.
|
// 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(
|
void ContinueShouldInterceptRequest(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
ShouldInterceptRequestResultCallback callback,
|
ShouldInterceptRequestResultCallback callback,
|
||||||
bool allow) {
|
bool allow) {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// The request may have been canceled while the async callback was
|
// The request may have been canceled while the async callback was
|
||||||
// pending.
|
// pending.
|
||||||
|
@ -685,7 +684,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
|
|
||||||
std::unique_ptr<ResourceResponse> resource_response;
|
std::unique_ptr<ResourceResponse> resource_response;
|
||||||
if (resource_handler) {
|
if (resource_handler) {
|
||||||
resource_response = CreateResourceResponse(id, resource_handler);
|
resource_response = CreateResourceResponse(request_id, resource_handler);
|
||||||
DCHECK(resource_response);
|
DCHECK(resource_response);
|
||||||
state->was_custom_handled_ = true;
|
state->was_custom_handled_ = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -699,13 +698,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
std::move(callback).Run(std::move(resource_response));
|
std::move(callback).Run(std::move(resource_response));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessResponseHeaders(const RequestId& id,
|
void ProcessResponseHeaders(int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
const GURL& redirect_url,
|
const GURL& redirect_url,
|
||||||
net::HttpResponseHeaders* headers) override {
|
net::HttpResponseHeaders* headers) override {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// The request may have been canceled during destruction.
|
// The request may have been canceled during destruction.
|
||||||
return;
|
return;
|
||||||
|
@ -725,14 +724,14 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
state->pending_response_->SetReadOnly(true);
|
state->pending_response_->SetReadOnly(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnRequestResponse(const RequestId& id,
|
void OnRequestResponse(int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
net::HttpResponseHeaders* headers,
|
net::HttpResponseHeaders* headers,
|
||||||
base::Optional<net::RedirectInfo> redirect_info,
|
base::Optional<net::RedirectInfo> redirect_info,
|
||||||
OnRequestResponseResultCallback callback) override {
|
OnRequestResponseResultCallback callback) override {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// The request may have been canceled during destruction.
|
// The request may have been canceled during destruction.
|
||||||
return;
|
return;
|
||||||
|
@ -746,7 +745,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
if (!state->handler_) {
|
if (!state->handler_) {
|
||||||
// Cookies may come from a scheme handler.
|
// Cookies may come from a scheme handler.
|
||||||
MaybeSaveCookies(
|
MaybeSaveCookies(
|
||||||
id, state, request, headers,
|
request_id, state, request, headers,
|
||||||
base::BindOnce(
|
base::BindOnce(
|
||||||
std::move(callback), ResponseMode::CONTINUE, nullptr,
|
std::move(callback), ResponseMode::CONTINUE, nullptr,
|
||||||
redirect_info.has_value() ? redirect_info->new_url : GURL()));
|
redirect_info.has_value() ? redirect_info->new_url : GURL()));
|
||||||
|
@ -757,14 +756,14 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
DCHECK(state->pending_response_);
|
DCHECK(state->pending_response_);
|
||||||
|
|
||||||
if (redirect_info.has_value()) {
|
if (redirect_info.has_value()) {
|
||||||
HandleRedirect(id, state, request, headers, *redirect_info,
|
HandleRedirect(request_id, state, request, headers, *redirect_info,
|
||||||
std::move(callback));
|
std::move(callback));
|
||||||
} else {
|
} 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,
|
RequestState* state,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
net::HttpResponseHeaders* headers,
|
net::HttpResponseHeaders* headers,
|
||||||
|
@ -797,10 +796,11 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
auto exec_callback = base::BindOnce(
|
auto exec_callback = base::BindOnce(
|
||||||
std::move(callback), ResponseMode::CONTINUE, nullptr, new_url);
|
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,
|
RequestState* state,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
net::HttpResponseHeaders* headers,
|
net::HttpResponseHeaders* headers,
|
||||||
|
@ -846,10 +846,11 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
return;
|
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,
|
RequestState* state,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
net::HttpResponseHeaders* headers,
|
net::HttpResponseHeaders* headers,
|
||||||
|
@ -875,23 +876,23 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
state->cookie_filter_
|
state->cookie_filter_
|
||||||
? base::BindRepeating(
|
? base::BindRepeating(
|
||||||
&InterceptedRequestHandlerWrapper::AllowCookieSave,
|
&InterceptedRequestHandlerWrapper::AllowCookieSave,
|
||||||
weak_ptr_factory_.GetWeakPtr(), id)
|
weak_ptr_factory_.GetWeakPtr(), request_id)
|
||||||
: base::BindRepeating(
|
: base::BindRepeating(
|
||||||
&InterceptedRequestHandlerWrapper::AllowCookieAlways);
|
&InterceptedRequestHandlerWrapper::AllowCookieAlways);
|
||||||
auto done_cookie_callback = base::BindOnce(
|
auto done_cookie_callback = base::BindOnce(
|
||||||
&InterceptedRequestHandlerWrapper::ContinueWithSavedCookies,
|
&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,
|
cookie_helper::SaveCookies(init_state_->browser_context_, *request, headers,
|
||||||
allow_cookie_callback,
|
allow_cookie_callback,
|
||||||
std::move(done_cookie_callback));
|
std::move(done_cookie_callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AllowCookieSave(const RequestId& id,
|
void AllowCookieSave(int32_t request_id,
|
||||||
const net::CanonicalCookie& cookie,
|
const net::CanonicalCookie& cookie,
|
||||||
bool* allow) {
|
bool* allow) {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// The request may have been canceled while the async callback was
|
// The request may have been canceled while the async callback was
|
||||||
// pending.
|
// pending.
|
||||||
|
@ -909,7 +910,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContinueWithSavedCookies(const RequestId& id,
|
void ContinueWithSavedCookies(int32_t request_id,
|
||||||
base::OnceClosure callback,
|
base::OnceClosure callback,
|
||||||
int total_count,
|
int total_count,
|
||||||
net::CookieList allowed_cookies) {
|
net::CookieList allowed_cookies) {
|
||||||
|
@ -918,12 +919,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
mojo::ScopedDataPipeConsumerHandle OnFilterResponseBody(
|
mojo::ScopedDataPipeConsumerHandle OnFilterResponseBody(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
mojo::ScopedDataPipeConsumerHandle body) override {
|
mojo::ScopedDataPipeConsumerHandle body) override {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// The request may have been canceled during destruction.
|
// The request may have been canceled during destruction.
|
||||||
return body;
|
return body;
|
||||||
|
@ -937,17 +938,17 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
return CreateResponseFilterHandler(
|
return CreateResponseFilterHandler(
|
||||||
filter, std::move(body),
|
filter, std::move(body),
|
||||||
base::BindOnce(&InterceptedRequestHandlerWrapper::OnFilterError,
|
base::BindOnce(&InterceptedRequestHandlerWrapper::OnFilterError,
|
||||||
weak_ptr_factory_.GetWeakPtr(), id));
|
weak_ptr_factory_.GetWeakPtr(), request_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnFilterError(const RequestId& id) {
|
void OnFilterError(int32_t request_id) {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// The request may have been canceled while the async callback was
|
// The request may have been canceled while the async callback was
|
||||||
// pending.
|
// pending.
|
||||||
|
@ -960,12 +961,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnRequestComplete(
|
void OnRequestComplete(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
const network::URLLoaderCompletionStatus& status) override {
|
const network::URLLoaderCompletionStatus& status) override {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
// The request may have been aborted during initialization or canceled
|
// The request may have been aborted during initialization or canceled
|
||||||
// during destruction. This method will always be called before a request
|
// during destruction. This method will always be called before a request
|
||||||
|
@ -974,7 +975,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
if (!pending_requests_.empty()) {
|
if (!pending_requests_.empty()) {
|
||||||
PendingRequests::iterator it = pending_requests_.begin();
|
PendingRequests::iterator it = pending_requests_.begin();
|
||||||
for (; it != pending_requests_.end(); ++it) {
|
for (; it != pending_requests_.end(); ++it) {
|
||||||
if ((*it)->id_ == id) {
|
if ((*it)->id_ == request_id) {
|
||||||
pending_requests_.erase(it);
|
pending_requests_.erase(it);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1011,7 +1012,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveState(id);
|
RemoveState(request_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1045,14 +1046,12 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
|
|
||||||
// Returns the handler, if any, that should be used for this request.
|
// Returns the handler, if any, that should be used for this request.
|
||||||
CefRefPtr<CefResourceRequestHandler> GetHandler(
|
CefRefPtr<CefResourceRequestHandler> GetHandler(
|
||||||
const RequestId& id,
|
int32_t request_id,
|
||||||
network::ResourceRequest* request,
|
network::ResourceRequest* request,
|
||||||
bool* intercept_only,
|
bool* intercept_only,
|
||||||
CefRefPtr<CefRequestImpl>& requestPtr) const {
|
CefRefPtr<CefRequestImpl>& requestPtr) const {
|
||||||
CefRefPtr<CefResourceRequestHandler> handler;
|
CefRefPtr<CefResourceRequestHandler> handler;
|
||||||
|
|
||||||
const int64 request_id = id.hash();
|
|
||||||
|
|
||||||
if (init_state_->browser_) {
|
if (init_state_->browser_) {
|
||||||
// Maybe the browser's client wants to handle it?
|
// Maybe the browser's client wants to handle it?
|
||||||
CefRefPtr<CefClient> client =
|
CefRefPtr<CefClient> client =
|
||||||
|
@ -1075,8 +1074,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
// Maybe the request context wants to handle it?
|
// Maybe the request context wants to handle it?
|
||||||
CefRefPtr<CefRequestContextHandler> context_handler =
|
CefRefPtr<CefRequestContextHandler> context_handler =
|
||||||
init_state_->iothread_state_->GetHandler(
|
init_state_->iothread_state_->GetHandler(
|
||||||
init_state_->render_process_id_, request->render_frame_id,
|
init_state_->render_process_id_, MSG_ROUTING_NONE,
|
||||||
init_state_->frame_tree_node_id_, false);
|
init_state_->frame_tree_node_id_, /*require_frame_match=*/false);
|
||||||
if (context_handler) {
|
if (context_handler) {
|
||||||
if (!requestPtr)
|
if (!requestPtr)
|
||||||
requestPtr = MakeRequest(request, request_id, true);
|
requestPtr = MakeRequest(request, request_id, true);
|
||||||
|
@ -1091,24 +1090,24 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestState* GetOrCreateState(const RequestId& id) {
|
RequestState* GetOrCreateState(int32_t request_id) {
|
||||||
RequestState* state = GetState(id);
|
RequestState* state = GetState(request_id);
|
||||||
if (!state) {
|
if (!state) {
|
||||||
state = new RequestState();
|
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;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestState* GetState(const RequestId& id) const {
|
RequestState* GetState(int32_t request_id) const {
|
||||||
RequestMap::const_iterator it = request_map_.find(id);
|
RequestMap::const_iterator it = request_map_.find(request_id);
|
||||||
if (it != request_map_.end())
|
if (it != request_map_.end())
|
||||||
return it->second.get();
|
return it->second.get();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveState(const RequestId& id) {
|
void RemoveState(int32_t request_id) {
|
||||||
RequestMap::iterator it = request_map_.find(id);
|
RequestMap::iterator it = request_map_.find(request_id);
|
||||||
DCHECK(it != request_map_.end());
|
DCHECK(it != request_map_.end());
|
||||||
if (it != request_map_.end())
|
if (it != request_map_.end())
|
||||||
request_map_.erase(it);
|
request_map_.erase(it);
|
||||||
|
@ -1186,7 +1185,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||||
|
|
||||||
bool shutting_down_ = false;
|
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_;
|
RequestMap request_map_;
|
||||||
|
|
||||||
using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>;
|
using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>;
|
||||||
|
@ -1220,27 +1219,21 @@ void InitOnUIThread(
|
||||||
|
|
||||||
content::RenderFrameHost* frame = nullptr;
|
content::RenderFrameHost* frame = nullptr;
|
||||||
|
|
||||||
if (request.render_frame_id >= 0) {
|
if (request.is_main_frame ||
|
||||||
// TODO(network): Are these main frame checks equivalent?
|
static_cast<blink::mojom::ResourceType>(request.resource_type) ==
|
||||||
if (request.is_main_frame ||
|
blink::mojom::ResourceType::kMainFrame) {
|
||||||
static_cast<blink::mojom::ResourceType>(request.resource_type) ==
|
frame = web_contents->GetMainFrame();
|
||||||
blink::mojom::ResourceType::kMainFrame) {
|
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();
|
frame = web_contents->GetMainFrame();
|
||||||
DCHECK(frame);
|
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 =
|
auto init_state =
|
||||||
std::make_unique<InterceptedRequestHandlerWrapper::InitState>();
|
std::make_unique<InterceptedRequestHandlerWrapper::InitState>();
|
||||||
init_state->Initialize(browser_context, browserPtr, framePtr,
|
init_state->Initialize(browser_context, browserPtr, framePtr,
|
||||||
render_process_id, request.render_frame_id,
|
render_process_id, frame_tree_node_id, is_navigation,
|
||||||
frame_tree_node_id, is_navigation, is_download,
|
is_download, request_initiator,
|
||||||
request_initiator, unhandled_request_callback);
|
unhandled_request_callback);
|
||||||
|
|
||||||
init_helper->MaybeSetInitialized(std::move(init_state));
|
init_helper->MaybeSetInitialized(std::move(init_state));
|
||||||
}
|
}
|
||||||
|
@ -1289,12 +1282,10 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
CefRefPtr<CefBrowserHostBase> browserPtr;
|
CefRefPtr<CefBrowserHostBase> browserPtr;
|
||||||
CefRefPtr<CefFrame> framePtr;
|
CefRefPtr<CefFrame> framePtr;
|
||||||
int render_frame_id = -1;
|
|
||||||
int frame_tree_node_id = -1;
|
int frame_tree_node_id = -1;
|
||||||
|
|
||||||
// |frame| may be null for service worker requests.
|
// |frame| may be null for service worker requests.
|
||||||
if (frame) {
|
if (frame) {
|
||||||
render_frame_id = frame->GetRoutingID();
|
|
||||||
frame_tree_node_id = frame->GetFrameTreeNodeId();
|
frame_tree_node_id = frame->GetFrameTreeNodeId();
|
||||||
|
|
||||||
// May return nullptr for requests originating from guest views.
|
// May return nullptr for requests originating from guest views.
|
||||||
|
@ -1308,9 +1299,8 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
|
||||||
auto init_state =
|
auto init_state =
|
||||||
std::make_unique<InterceptedRequestHandlerWrapper::InitState>();
|
std::make_unique<InterceptedRequestHandlerWrapper::InitState>();
|
||||||
init_state->Initialize(browser_context, browserPtr, framePtr,
|
init_state->Initialize(browser_context, browserPtr, framePtr,
|
||||||
render_process_id, render_frame_id, frame_tree_node_id,
|
render_process_id, frame_tree_node_id, is_navigation,
|
||||||
is_navigation, is_download, request_initiator,
|
is_download, request_initiator, base::Closure());
|
||||||
base::Closure());
|
|
||||||
|
|
||||||
auto wrapper = std::make_unique<InterceptedRequestHandlerWrapper>();
|
auto wrapper = std::make_unique<InterceptedRequestHandlerWrapper>();
|
||||||
wrapper->init_helper()->MaybeSetInitialized(std::move(init_state));
|
wrapper->init_helper()->MaybeSetInitialized(std::move(init_state));
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
|
#include "base/task/thread_pool.h"
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
#include "base/threading/thread_task_runner_handle.h"
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
@ -37,7 +38,7 @@ class OpenInputStreamWrapper
|
||||||
static base::OnceClosure Open(
|
static base::OnceClosure Open(
|
||||||
std::unique_ptr<StreamReaderURLLoader::Delegate> delegate,
|
std::unique_ptr<StreamReaderURLLoader::Delegate> delegate,
|
||||||
scoped_refptr<base::SequencedTaskRunner> work_thread_task_runner,
|
scoped_refptr<base::SequencedTaskRunner> work_thread_task_runner,
|
||||||
const RequestId& request_id,
|
int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
OnInputStreamOpenedCallback callback) WARN_UNUSED_RESULT {
|
OnInputStreamOpenedCallback callback) WARN_UNUSED_RESULT {
|
||||||
scoped_refptr<OpenInputStreamWrapper> wrapper = new OpenInputStreamWrapper(
|
scoped_refptr<OpenInputStreamWrapper> wrapper = new OpenInputStreamWrapper(
|
||||||
|
@ -62,8 +63,7 @@ class OpenInputStreamWrapper
|
||||||
callback_(std::move(callback)) {}
|
callback_(std::move(callback)) {}
|
||||||
virtual ~OpenInputStreamWrapper() {}
|
virtual ~OpenInputStreamWrapper() {}
|
||||||
|
|
||||||
void Start(const RequestId& request_id,
|
void Start(int32_t request_id, const network::ResourceRequest& request) {
|
||||||
const network::ResourceRequest& request) {
|
|
||||||
work_thread_task_runner_->PostTask(
|
work_thread_task_runner_->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::BindOnce(&OpenInputStreamWrapper::OpenOnWorkThread,
|
base::BindOnce(&OpenInputStreamWrapper::OpenOnWorkThread,
|
||||||
|
@ -95,7 +95,7 @@ class OpenInputStreamWrapper
|
||||||
OnCallback(nullptr);
|
OnCallback(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenOnWorkThread(const RequestId& request_id,
|
void OpenOnWorkThread(int32_t request_id,
|
||||||
const network::ResourceRequest& request) {
|
const network::ResourceRequest& request) {
|
||||||
DCHECK(work_thread_task_runner_->RunsTasksInCurrentSequence());
|
DCHECK(work_thread_task_runner_->RunsTasksInCurrentSequence());
|
||||||
if (is_canceled_)
|
if (is_canceled_)
|
||||||
|
@ -455,30 +455,12 @@ void InputStreamReader::RunReadCallbackOnJobThread(
|
||||||
std::move(read_callback).Run(bytes_read);
|
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::StreamReaderURLLoader(
|
StreamReaderURLLoader::StreamReaderURLLoader(
|
||||||
const RequestId& request_id,
|
int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||||
mojo::PendingRemote<network::mojom::TrustedHeaderClient> header_client,
|
mojo::PendingRemote<network::mojom::TrustedHeaderClient> header_client,
|
||||||
|
@ -502,7 +484,7 @@ StreamReaderURLLoader::StreamReaderURLLoader(
|
||||||
|
|
||||||
// All InputStream work will be performed on this task runner.
|
// All InputStream work will be performed on this task runner.
|
||||||
stream_work_task_runner_ =
|
stream_work_task_runner_ =
|
||||||
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock()});
|
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()});
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamReaderURLLoader::~StreamReaderURLLoader() {
|
StreamReaderURLLoader::~StreamReaderURLLoader() {
|
||||||
|
|
|
@ -63,54 +63,6 @@ class InputStream {
|
||||||
ReadCallback callback) = 0;
|
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
|
// Abstract class for handling intercepted resource responses. All methods are
|
||||||
// called on the IO thread unless otherwise indicated.
|
// called on the IO thread unless otherwise indicated.
|
||||||
class ResourceResponse {
|
class ResourceResponse {
|
||||||
|
@ -125,13 +77,13 @@ class ResourceResponse {
|
||||||
// |callback| to continue the request. Return false to cancel the request.
|
// |callback| to continue the request. Return false to cancel the request.
|
||||||
// |request| may be different from the request used to create the
|
// |request| may be different from the request used to create the
|
||||||
// StreamReaderURLLoader if a redirect was followed.
|
// StreamReaderURLLoader if a redirect was followed.
|
||||||
virtual bool OpenInputStream(const RequestId& id,
|
virtual bool OpenInputStream(int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
OpenCallback callback) = 0;
|
OpenCallback callback) = 0;
|
||||||
|
|
||||||
// This method is called to populate the response headers.
|
// This method is called to populate the response headers.
|
||||||
using HeaderMap = std::multimap<std::string, std::string>;
|
using HeaderMap = std::multimap<std::string, std::string>;
|
||||||
virtual void GetResponseHeaders(const RequestId& id,
|
virtual void GetResponseHeaders(int32_t request_id,
|
||||||
int* status_code,
|
int* status_code,
|
||||||
std::string* reason_phrase,
|
std::string* reason_phrase,
|
||||||
std::string* mime_type,
|
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.
|
// This method is called if the result of calling OpenInputStream was null.
|
||||||
// The |restarted| parameter is set to true if the request was restarted
|
// The |restarted| parameter is set to true if the request was restarted
|
||||||
// with a new loader.
|
// with a new loader.
|
||||||
virtual void OnInputStreamOpenFailed(const RequestId& id,
|
virtual void OnInputStreamOpenFailed(int32_t request_id,
|
||||||
bool* restarted) = 0;
|
bool* restarted) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
StreamReaderURLLoader(
|
StreamReaderURLLoader(
|
||||||
const RequestId& request_id,
|
int32_t request_id,
|
||||||
const network::ResourceRequest& request,
|
const network::ResourceRequest& request,
|
||||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||||
mojo::PendingRemote<network::mojom::TrustedHeaderClient> header_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 ParseRange(const net::HttpRequestHeaders& headers);
|
||||||
bool byte_range_valid() const;
|
bool byte_range_valid() const;
|
||||||
|
|
||||||
const RequestId request_id_;
|
const int32_t request_id_;
|
||||||
|
|
||||||
size_t header_length_ = 0;
|
size_t header_length_ = 0;
|
||||||
int64_t total_bytes_read_ = 0;
|
int64_t total_bytes_read_ = 0;
|
||||||
|
|
|
@ -325,8 +325,9 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_rwh_for_drag_->DragTargetDragEnter(
|
current_rwh_for_drag_->DragTargetDragEnter(*drop_data, transformed_pt,
|
||||||
*drop_data, transformed_pt, gfx::PointF(screen_pt), ops, modifiers);
|
gfx::PointF(screen_pt), ops,
|
||||||
|
modifiers, base::DoNothing());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
||||||
|
@ -381,7 +382,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
||||||
int modifiers = TranslateWebEventModifiers(event.modifiers);
|
int modifiers = TranslateWebEventModifiers(event.modifiers);
|
||||||
|
|
||||||
target_rwh->DragTargetDragOver(transformed_pt, gfx::PointF(screen_pt), ops,
|
target_rwh->DragTargetDragOver(transformed_pt, gfx::PointF(screen_pt), ops,
|
||||||
modifiers);
|
modifiers, base::DoNothing());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
||||||
|
@ -451,7 +452,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
||||||
int modifiers = TranslateWebEventModifiers(event.modifiers);
|
int modifiers = TranslateWebEventModifiers(event.modifiers);
|
||||||
|
|
||||||
target_rwh->DragTargetDrop(*drop_data, transformed_pt,
|
target_rwh->DragTargetDrop(*drop_data, transformed_pt,
|
||||||
gfx::PointF(screen_pt), modifiers);
|
gfx::PointF(screen_pt), modifiers,
|
||||||
|
base::DoNothing());
|
||||||
}
|
}
|
||||||
|
|
||||||
drag_data_ = nullptr;
|
drag_data_ = nullptr;
|
||||||
|
|
|
@ -653,7 +653,7 @@ void CefRenderWidgetHostViewOSR::Destroy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::SetTooltipText(
|
void CefRenderWidgetHostViewOSR::SetTooltipText(
|
||||||
const base::string16& tooltip_text) {
|
const std::u16string& tooltip_text) {
|
||||||
if (!browser_impl_.get())
|
if (!browser_impl_.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -817,7 +817,7 @@ void CefRenderWidgetHostViewOSR::ImeCancelComposition() {
|
||||||
RequestImeCompositionUpdate(false);
|
RequestImeCompositionUpdate(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::SelectionChanged(const base::string16& text,
|
void CefRenderWidgetHostViewOSR::SelectionChanged(const std::u16string& text,
|
||||||
size_t offset,
|
size_t offset,
|
||||||
const gfx::Range& range) {
|
const gfx::Range& range) {
|
||||||
RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
|
RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
|
||||||
|
@ -1406,6 +1406,15 @@ void CefRenderWidgetHostViewOSR::SpeakSelection() {}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::SetWindowFrameInScreen(const gfx::Rect& rect) {
|
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)
|
#endif // defined(OS_MAC)
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
|
void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
|
||||||
|
|
|
@ -134,6 +134,12 @@ class CefRenderWidgetHostViewOSR
|
||||||
void ShowDefinitionForSelection() override;
|
void ShowDefinitionForSelection() override;
|
||||||
void SpeakSelection() override;
|
void SpeakSelection() override;
|
||||||
void SetWindowFrameInScreen(const gfx::Rect& rect) 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)
|
#endif // defined(OS_MAC)
|
||||||
|
|
||||||
// RenderWidgetHostViewBase implementation.
|
// RenderWidgetHostViewBase implementation.
|
||||||
|
@ -144,7 +150,7 @@ class CefRenderWidgetHostViewOSR
|
||||||
void SetIsLoading(bool is_loading) override;
|
void SetIsLoading(bool is_loading) override;
|
||||||
void RenderProcessGone() override;
|
void RenderProcessGone() override;
|
||||||
void Destroy() override;
|
void Destroy() override;
|
||||||
void SetTooltipText(const base::string16& tooltip_text) override;
|
void SetTooltipText(const std::u16string& tooltip_text) override;
|
||||||
content::CursorManager* GetCursorManager() override;
|
content::CursorManager* GetCursorManager() override;
|
||||||
gfx::Size GetCompositorViewportPixelSize() override;
|
gfx::Size GetCompositorViewportPixelSize() override;
|
||||||
void CopyFromSurface(
|
void CopyFromSurface(
|
||||||
|
@ -171,7 +177,7 @@ class CefRenderWidgetHostViewOSR
|
||||||
RenderWidgetHostViewBase* target_view,
|
RenderWidgetHostViewBase* target_view,
|
||||||
gfx::PointF* transformed_point) override;
|
gfx::PointF* transformed_point) override;
|
||||||
void DidNavigate() override;
|
void DidNavigate() override;
|
||||||
void SelectionChanged(const base::string16& text,
|
void SelectionChanged(const std::u16string& text,
|
||||||
size_t offset,
|
size_t offset,
|
||||||
const gfx::Range& range) override;
|
const gfx::Range& range) override;
|
||||||
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;
|
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;
|
||||||
|
|
|
@ -128,7 +128,7 @@ CefWebContentsViewOSR::CreateViewForChildWidget(
|
||||||
render_widget_host, view);
|
render_widget_host, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {}
|
void CefWebContentsViewOSR::SetPageTitle(const std::u16string& title) {}
|
||||||
|
|
||||||
void CefWebContentsViewOSR::RenderViewReady() {
|
void CefWebContentsViewOSR::RenderViewReady() {
|
||||||
RenderViewCreated();
|
RenderViewCreated();
|
||||||
|
|
|
@ -50,7 +50,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||||
content::RenderWidgetHost* render_widget_host) override;
|
content::RenderWidgetHost* render_widget_host) override;
|
||||||
content::RenderWidgetHostViewBase* CreateViewForChildWidget(
|
content::RenderWidgetHostViewBase* CreateViewForChildWidget(
|
||||||
content::RenderWidgetHost* render_widget_host) override;
|
content::RenderWidgetHost* render_widget_host) override;
|
||||||
void SetPageTitle(const base::string16& title) override;
|
void SetPageTitle(const std::u16string& title) override;
|
||||||
void RenderViewReady() override;
|
void RenderViewReady() override;
|
||||||
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
||||||
content::RenderViewHost* new_host) override;
|
content::RenderViewHost* new_host) override;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
|
#include "base/task/thread_pool.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "chrome/browser/accessibility/accessibility_ui.h"
|
#include "chrome/browser/accessibility/accessibility_ui.h"
|
||||||
#include "chrome/browser/download/download_prefs.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
|
// Get sequenced task runner for making sure that file operations are
|
||||||
// executed in expected order (what was previously assured by the FILE
|
// executed in expected order (what was previously assured by the FILE
|
||||||
// thread).
|
// thread).
|
||||||
sequenced_task_runner = base::CreateSequencedTaskRunner(
|
sequenced_task_runner = base::ThreadPool::CreateSequencedTaskRunner(
|
||||||
{base::ThreadPool(), base::MayBlock(),
|
{base::MayBlock(), base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to store user preferences.
|
// Used to store user preferences.
|
||||||
|
|
|
@ -42,7 +42,7 @@ void CefPrefStore::RemoveObserver(PrefStore::Observer* observer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefPrefStore::HasObservers() const {
|
bool CefPrefStore::HasObservers() const {
|
||||||
return observers_.might_have_observers();
|
return !observers_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefPrefStore::IsInitializationComplete() const {
|
bool CefPrefStore::IsInitializationComplete() const {
|
||||||
|
|
|
@ -165,12 +165,9 @@ void SetExtensionPrefs(content::RenderViewHost* rvh,
|
||||||
if (!site_url.SchemeIs(extensions::kExtensionScheme))
|
if (!site_url.SchemeIs(extensions::kExtensionScheme))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
content::WebContents* web_contents =
|
|
||||||
content::WebContents::FromRenderViewHost(rvh);
|
|
||||||
extensions::ViewType view_type = extensions::GetViewType(web_contents);
|
|
||||||
const extensions::Extension* extension =
|
const extensions::Extension* extension =
|
||||||
registry->enabled_extensions().GetByID(site_url.host());
|
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,
|
void SetString(CommandLinePrefStore* prefs,
|
||||||
|
|
|
@ -186,7 +186,7 @@ void CefPrintDialogLinux::ShowDialog(
|
||||||
|
|
||||||
void CefPrintDialogLinux::PrintDocument(
|
void CefPrintDialogLinux::PrintDocument(
|
||||||
const printing::MetafilePlayer& metafile,
|
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.
|
// This runs on the print worker thread, does not block the UI thread.
|
||||||
DCHECK(!CEF_CURRENTLY_ON_UIT());
|
DCHECK(!CEF_CURRENTLY_ON_UIT());
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ bool CefPrintDialogLinux::UpdateSettings(
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintDialogLinux::SendDocumentToPrinter(
|
void CefPrintDialogLinux::SendDocumentToPrinter(
|
||||||
const base::string16& document_name) {
|
const std::u16string& document_name) {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
|
||||||
if (!handler_.get()) {
|
if (!handler_.get()) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface,
|
||||||
bool has_selection,
|
bool has_selection,
|
||||||
PrintingContextLinux::PrintSettingsCallback callback) override;
|
PrintingContextLinux::PrintSettingsCallback callback) override;
|
||||||
void PrintDocument(const printing::MetafilePlayer& metafile,
|
void PrintDocument(const printing::MetafilePlayer& metafile,
|
||||||
const base::string16& document_name) override;
|
const std::u16string& document_name) override;
|
||||||
void AddRefToDialog() override;
|
void AddRefToDialog() override;
|
||||||
void ReleaseDialog() override;
|
void ReleaseDialog() override;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface,
|
||||||
bool get_defaults);
|
bool get_defaults);
|
||||||
|
|
||||||
// Prints document named |document_name|.
|
// Prints document named |document_name|.
|
||||||
void SendDocumentToPrinter(const base::string16& document_name);
|
void SendDocumentToPrinter(const std::u16string& document_name);
|
||||||
|
|
||||||
// Handles print dialog response.
|
// Handles print dialog response.
|
||||||
void OnPrintContinue(CefRefPtr<CefPrintSettings> settings);
|
void OnPrintContinue(CefRefPtr<CefPrintSettings> settings);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
|
#include "base/task/thread_pool.h"
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
#include "net/http/http_request_headers.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
|
// Make sure the task is executed on shutdown. Otherwise, |thread| might
|
||||||
// be released outside of the correct scope.
|
// be released outside of the correct scope.
|
||||||
base::PostTask(
|
base::ThreadPool::PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
|
{base::TaskPriority::BEST_EFFORT,
|
||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()},
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()},
|
||||||
std::move(task));
|
std::move(task));
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "base/location.h"
|
#include "base/location.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
|
#include "base/task/thread_pool.h"
|
||||||
#include "base/threading/scoped_blocking_call.h"
|
#include "base/threading/scoped_blocking_call.h"
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
#include "content/public/browser/browser_task_traits.h"
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
|
@ -55,11 +56,11 @@
|
||||||
// Sequenced runners at various priorities that always execute all pending tasks
|
// Sequenced runners at various priorities that always execute all pending tasks
|
||||||
// before shutdown are available via CefTaskRunnerManager and exposed by the CEF
|
// before shutdown are available via CefTaskRunnerManager and exposed by the CEF
|
||||||
// API.
|
// API.
|
||||||
#define CEF_POST_BLOCKING_TASK(priority, task) \
|
#define CEF_POST_BLOCKING_TASK(priority, task) \
|
||||||
base::PostTask( \
|
base::ThreadPool::PostTask( \
|
||||||
FROM_HERE, \
|
FROM_HERE, \
|
||||||
{base::ThreadPool(), priority, \
|
{priority, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, \
|
||||||
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, base::MayBlock()}, \
|
base::MayBlock()}, \
|
||||||
task)
|
task)
|
||||||
|
|
||||||
// Post a blocking task that affects UI or responsiveness of future user
|
// Post a blocking task that affects UI or responsiveness of future user
|
||||||
|
|
|
@ -23,7 +23,7 @@ class LabelButtonEx : public views::LabelButton {
|
||||||
self->ButtonPressed(event);
|
self->ButtonPressed(event);
|
||||||
},
|
},
|
||||||
base::Unretained(this)),
|
base::Unretained(this)),
|
||||||
base::string16()) {}
|
std::u16string()) {}
|
||||||
|
|
||||||
virtual void ButtonPressed(const ui::Event& event) = 0;
|
virtual void ButtonPressed(const ui::Event& event) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,8 +31,8 @@ void CefMenuRunnerViews::CancelContextMenu() {
|
||||||
window->CancelMenu();
|
window->CancelMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefMenuRunnerViews::FormatLabel(base::string16& label) {
|
bool CefMenuRunnerViews::FormatLabel(std::u16string& label) {
|
||||||
// Remove the accelerator indicator (&) from label strings.
|
// Remove the accelerator indicator (&) from label strings.
|
||||||
const base::string16::value_type replace[] = {L'&', 0};
|
const std::u16string::value_type replace[] = {L'&', 0};
|
||||||
return base::ReplaceChars(label, replace, base::string16(), &label);
|
return base::ReplaceChars(label, replace, std::u16string(), &label);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class CefMenuRunnerViews : public CefMenuRunner {
|
||||||
CefMenuModelImpl* model,
|
CefMenuModelImpl* model,
|
||||||
const content::ContextMenuParams& params) override;
|
const content::ContextMenuParams& params) override;
|
||||||
void CancelContextMenu() override;
|
void CancelContextMenu() override;
|
||||||
bool FormatLabel(base::string16& label) override;
|
bool FormatLabel(std::u16string& label) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CefBrowserViewImpl* browser_view_;
|
CefBrowserViewImpl* browser_view_;
|
||||||
|
|
|
@ -359,7 +359,7 @@ bool CefWindowView::CanMaximize() const {
|
||||||
return cef_delegate()->CanMaximize(GetCefWindow());
|
return cef_delegate()->CanMaximize(GetCefWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
base::string16 CefWindowView::GetWindowTitle() const {
|
std::u16string CefWindowView::GetWindowTitle() const {
|
||||||
return title_;
|
return title_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ display::Display CefWindowView::GetDisplay() const {
|
||||||
return display::Display();
|
return display::Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefWindowView::SetTitle(const base::string16& title) {
|
void CefWindowView::SetTitle(const std::u16string& title) {
|
||||||
title_ = title;
|
title_ = title;
|
||||||
views::Widget* widget = GetWidget();
|
views::Widget* widget = GetWidget();
|
||||||
if (widget)
|
if (widget)
|
||||||
|
|
|
@ -57,7 +57,7 @@ class CefWindowView
|
||||||
bool CanResize() const override;
|
bool CanResize() const override;
|
||||||
bool CanMinimize() const override;
|
bool CanMinimize() const override;
|
||||||
bool CanMaximize() const override;
|
bool CanMaximize() const override;
|
||||||
base::string16 GetWindowTitle() const override;
|
std::u16string GetWindowTitle() const override;
|
||||||
gfx::ImageSkia GetWindowIcon() override;
|
gfx::ImageSkia GetWindowIcon() override;
|
||||||
gfx::ImageSkia GetWindowAppIcon() override;
|
gfx::ImageSkia GetWindowAppIcon() override;
|
||||||
void WindowClosing() override;
|
void WindowClosing() override;
|
||||||
|
@ -79,8 +79,8 @@ class CefWindowView
|
||||||
display::Display GetDisplay() const;
|
display::Display GetDisplay() const;
|
||||||
|
|
||||||
// Set/get the window title.
|
// Set/get the window title.
|
||||||
void SetTitle(const base::string16& title);
|
void SetTitle(const std::u16string& title);
|
||||||
base::string16 title() const { return title_; }
|
std::u16string title() const { return title_; }
|
||||||
|
|
||||||
// Set/get the window icon. This should be a 16x16 icon suitable for use in
|
// Set/get the window icon. This should be a 16x16 icon suitable for use in
|
||||||
// the Windows's title bar.
|
// the Windows's title bar.
|
||||||
|
@ -108,7 +108,7 @@ class CefWindowView
|
||||||
// True if the window is frameless. It might still be resizable and draggable.
|
// True if the window is frameless. It might still be resizable and draggable.
|
||||||
bool is_frameless_;
|
bool is_frameless_;
|
||||||
|
|
||||||
base::string16 title_;
|
std::u16string title_;
|
||||||
CefRefPtr<CefImage> window_icon_;
|
CefRefPtr<CefImage> window_icon_;
|
||||||
CefRefPtr<CefImage> window_app_icon_;
|
CefRefPtr<CefImage> window_app_icon_;
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,8 @@ void AlloyContentClient::AddAdditionalSchemes(Schemes* schemes) {
|
||||||
CefAppManager::Get()->AddAdditionalSchemes(schemes);
|
CefAppManager::Get()->AddAdditionalSchemes(schemes);
|
||||||
}
|
}
|
||||||
|
|
||||||
base::string16 AlloyContentClient::GetLocalizedString(int message_id) {
|
std::u16string AlloyContentClient::GetLocalizedString(int message_id) {
|
||||||
base::string16 value =
|
std::u16string value =
|
||||||
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(message_id);
|
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(message_id);
|
||||||
if (value.empty())
|
if (value.empty())
|
||||||
LOG(ERROR) << "No localized string available for id " << message_id;
|
LOG(ERROR) << "No localized string available for id " << message_id;
|
||||||
|
@ -115,10 +115,10 @@ base::string16 AlloyContentClient::GetLocalizedString(int message_id) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
base::string16 AlloyContentClient::GetLocalizedString(
|
std::u16string AlloyContentClient::GetLocalizedString(
|
||||||
int message_id,
|
int message_id,
|
||||||
const base::string16& replacement) {
|
const std::u16string& replacement) {
|
||||||
base::string16 value = l10n_util::GetStringFUTF16(message_id, replacement);
|
std::u16string value = l10n_util::GetStringFUTF16(message_id, replacement);
|
||||||
if (value.empty())
|
if (value.empty())
|
||||||
LOG(ERROR) << "No localized string available for id " << message_id;
|
LOG(ERROR) << "No localized string available for id " << message_id;
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ class AlloyContentClient : public content::ContentClient {
|
||||||
std::vector<content::CdmInfo>* cdms,
|
std::vector<content::CdmInfo>* cdms,
|
||||||
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) override;
|
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) override;
|
||||||
void AddAdditionalSchemes(Schemes* schemes) override;
|
void AddAdditionalSchemes(Schemes* schemes) override;
|
||||||
base::string16 GetLocalizedString(int message_id) override;
|
std::u16string GetLocalizedString(int message_id) override;
|
||||||
base::string16 GetLocalizedString(int message_id,
|
std::u16string GetLocalizedString(int message_id,
|
||||||
const base::string16& replacement) override;
|
const std::u16string& replacement) override;
|
||||||
base::StringPiece GetDataResource(int resource_id,
|
base::StringPiece GetDataResource(int resource_id,
|
||||||
ui::ScaleFactor scale_factor) override;
|
ui::ScaleFactor scale_factor) override;
|
||||||
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;
|
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;
|
||||||
|
|
|
@ -43,7 +43,7 @@ void CefCommandLineImpl::InitFromArgv(int argc, const char* const* argv) {
|
||||||
void CefCommandLineImpl::InitFromString(const CefString& command_line) {
|
void CefCommandLineImpl::InitFromString(const CefString& command_line) {
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
CEF_VALUE_VERIFY_RETURN_VOID(true);
|
CEF_VALUE_VERIFY_RETURN_VOID(true);
|
||||||
const base::string16& str16 = command_line;
|
const std::wstring& str16 = command_line;
|
||||||
mutable_value()->ParseFromString(str16);
|
mutable_value()->ParseFromString(str16);
|
||||||
#else
|
#else
|
||||||
NOTREACHED() << "method not supported on this platform";
|
NOTREACHED() << "method not supported on this platform";
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue