The Blink Rename

This commit is contained in:
Aleksei Kuzmin 2017-06-16 23:42:33 +03:00
parent 3939359354
commit 7a4ca08a8d
32 changed files with 452 additions and 450 deletions

View file

@ -21,11 +21,11 @@ namespace atom {
namespace api {
RenderView* GetCurrentRenderView() {
WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext();
WebLocalFrame* frame = WebLocalFrame::FrameForCurrentContext();
if (!frame)
return nullptr;
WebView* view = frame->view();
WebView* view = frame->View();
if (!view)
return nullptr; // can happen during closing.

View file

@ -51,41 +51,41 @@ SpellCheckClient::SpellCheckClient(const std::string& language,
SpellCheckClient::~SpellCheckClient() {}
void SpellCheckClient::checkSpelling(
void SpellCheckClient::CheckSpelling(
const blink::WebString& text,
int& misspelling_start,
int& misspelling_len,
blink::WebVector<blink::WebString>* optional_suggestions) {
std::vector<blink::WebTextCheckingResult> results;
SpellCheckText(text.utf16(), true, &results);
SpellCheckText(text.Utf16(), true, &results);
if (results.size() == 1) {
misspelling_start = results[0].location;
misspelling_len = results[0].length;
}
}
void SpellCheckClient::requestCheckingOfText(
void SpellCheckClient::RequestCheckingOfText(
const blink::WebString& textToCheck,
blink::WebTextCheckingCompletion* completionCallback) {
base::string16 text(textToCheck.utf16());
base::string16 text(textToCheck.Utf16());
if (text.empty() || !HasWordCharacters(text, 0)) {
completionCallback->didCancelCheckingText();
completionCallback->DidCancelCheckingText();
return;
}
std::vector<blink::WebTextCheckingResult> results;
SpellCheckText(text, false, &results);
completionCallback->didFinishCheckingText(results);
completionCallback->DidFinishCheckingText(results);
}
void SpellCheckClient::showSpellingUI(bool show) {
void SpellCheckClient::ShowSpellingUI(bool show) {
}
bool SpellCheckClient::isShowingSpellingUI() {
bool SpellCheckClient::IsShowingSpellingUI() {
return false;
}
void SpellCheckClient::updateSpellingUIWithMisspelledWord(
void SpellCheckClient::UpdateSpellingUIWithMisspelledWord(
const blink::WebString& word) {
}

View file

@ -31,17 +31,17 @@ class SpellCheckClient : public blink::WebSpellCheckClient {
private:
// blink::WebSpellCheckClient:
void checkSpelling(
void CheckSpelling(
const blink::WebString& text,
int& misspelledOffset,
int& misspelledLength,
blink::WebVector<blink::WebString>* optionalSuggestions) override;
void requestCheckingOfText(
void RequestCheckingOfText(
const blink::WebString& textToCheck,
blink::WebTextCheckingCompletion* completionCallback) override;
void showSpellingUI(bool show) override;
bool isShowingSpellingUI() override;
void updateSpellingUIWithMisspelledWord(
void ShowSpellingUI(bool show) override;
bool IsShowingSpellingUI() override;
void UpdateSpellingUIWithMisspelledWord(
const blink::WebString& word) override;
// Check the spelling of text.

View file

@ -44,9 +44,9 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
: callback_(callback) {}
~ScriptExecutionCallback() override {}
void completed(
void Completed(
const blink::WebVector<v8::Local<v8::Value>>& result) override {
if (!callback_.is_null() && !result.isEmpty() && !result[0].IsEmpty())
if (!callback_.is_null() && !result.IsEmpty() && !result[0].IsEmpty())
// Right now only single results per frame is supported.
callback_.Run(result[0]);
delete this;
@ -61,7 +61,7 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
} // namespace
WebFrame::WebFrame(v8::Isolate* isolate)
: web_frame_(blink::WebLocalFrame::frameForCurrentContext()) {
: web_frame_(blink::WebLocalFrame::FrameForCurrentContext()) {
Init(isolate);
}
@ -69,13 +69,13 @@ WebFrame::~WebFrame() {
}
void WebFrame::SetName(const std::string& name) {
web_frame_->setName(blink::WebString::fromUTF8(name));
web_frame_->SetName(blink::WebString::FromUTF8(name));
}
double WebFrame::SetZoomLevel(double level) {
double result = 0.0;
content::RenderView* render_view =
content::RenderView::FromWebView(web_frame_->view());
content::RenderView::FromWebView(web_frame_->View());
render_view->Send(new AtomViewHostMsg_SetTemporaryZoomLevel(
render_view->GetRoutingID(), level, &result));
return result;
@ -84,34 +84,34 @@ double WebFrame::SetZoomLevel(double level) {
double WebFrame::GetZoomLevel() const {
double result = 0.0;
content::RenderView* render_view =
content::RenderView::FromWebView(web_frame_->view());
content::RenderView::FromWebView(web_frame_->View());
render_view->Send(
new AtomViewHostMsg_GetZoomLevel(render_view->GetRoutingID(), &result));
return result;
}
double WebFrame::SetZoomFactor(double factor) {
return blink::WebView::zoomLevelToZoomFactor(SetZoomLevel(
blink::WebView::zoomFactorToZoomLevel(factor)));
return blink::WebView::ZoomLevelToZoomFactor(SetZoomLevel(
blink::WebView::ZoomFactorToZoomLevel(factor)));
}
double WebFrame::GetZoomFactor() const {
return blink::WebView::zoomLevelToZoomFactor(GetZoomLevel());
return blink::WebView::ZoomLevelToZoomFactor(GetZoomLevel());
}
void WebFrame::SetVisualZoomLevelLimits(double min_level, double max_level) {
web_frame_->view()->setDefaultPageScaleLimits(min_level, max_level);
web_frame_->View()->SetDefaultPageScaleLimits(min_level, max_level);
}
void WebFrame::SetLayoutZoomLevelLimits(double min_level, double max_level) {
web_frame_->view()->zoomLimitsChanged(min_level, max_level);
web_frame_->View()->ZoomLimitsChanged(min_level, max_level);
}
v8::Local<v8::Value> WebFrame::RegisterEmbedderCustomElement(
const base::string16& name, v8::Local<v8::Object> options) {
blink::WebExceptionCode c = 0;
return web_frame_->document().registerEmbedderCustomElement(
blink::WebString::fromUTF16(name), options, c);
return web_frame_->GetDocument().RegisterEmbedderCustomElement(
blink::WebString::FromUTF16(name), options, c);
}
void WebFrame::RegisterElementResizeCallback(
@ -141,19 +141,19 @@ void WebFrame::SetSpellCheckProvider(mate::Arguments* args,
spell_check_client_.reset(new SpellCheckClient(
language, auto_spell_correct_turned_on, args->isolate(), provider));
web_frame_->view()->setSpellCheckClient(spell_check_client_.get());
web_frame_->View()->SetSpellCheckClient(spell_check_client_.get());
}
void WebFrame::RegisterURLSchemeAsSecure(const std::string& scheme) {
// TODO(pfrazee): Remove 2.0
blink::SchemeRegistry::registerURLSchemeAsSecure(
WTF::String::fromUTF8(scheme.data(), scheme.length()));
blink::SchemeRegistry::RegisterURLSchemeAsSecure(
WTF::String::FromUTF8(scheme.data(), scheme.length()));
}
void WebFrame::RegisterURLSchemeAsBypassingCSP(const std::string& scheme) {
// Register scheme to bypass pages's Content Security Policy.
blink::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(
WTF::String::fromUTF8(scheme.data(), scheme.length()));
blink::SchemeRegistry::RegisterURLSchemeAsBypassingContentSecurityPolicy(
WTF::String::FromUTF8(scheme.data(), scheme.length()));
}
void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme,
@ -176,39 +176,39 @@ void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme,
}
// Register scheme to privileged list (https, wss, data, chrome-extension)
WTF::String privileged_scheme(
WTF::String::fromUTF8(scheme.data(), scheme.length()));
WTF::String::FromUTF8(scheme.data(), scheme.length()));
if (secure) {
// TODO(pfrazee): Remove 2.0
blink::SchemeRegistry::registerURLSchemeAsSecure(privileged_scheme);
blink::SchemeRegistry::RegisterURLSchemeAsSecure(privileged_scheme);
}
if (bypassCSP) {
blink::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(
blink::SchemeRegistry::RegisterURLSchemeAsBypassingContentSecurityPolicy(
privileged_scheme);
}
if (allowServiceWorkers) {
blink::SchemeRegistry::registerURLSchemeAsAllowingServiceWorkers(
blink::SchemeRegistry::RegisterURLSchemeAsAllowingServiceWorkers(
privileged_scheme);
}
if (supportFetchAPI) {
blink::SchemeRegistry::registerURLSchemeAsSupportingFetchAPI(
blink::SchemeRegistry::RegisterURLSchemeAsSupportingFetchAPI(
privileged_scheme);
}
if (corsEnabled) {
blink::SchemeRegistry::registerURLSchemeAsCORSEnabled(privileged_scheme);
blink::SchemeRegistry::RegisterURLSchemeAsCORSEnabled(privileged_scheme);
}
}
void WebFrame::InsertText(const std::string& text) {
web_frame_->frameWidget()
->getActiveWebInputMethodController()
->commitText(blink::WebString::fromUTF8(text),
web_frame_->FrameWidget()
->GetActiveWebInputMethodController()
->CommitText(blink::WebString::FromUTF8(text),
blink::WebVector<blink::WebCompositionUnderline>(),
blink::WebRange(),
0);
}
void WebFrame::InsertCSS(const std::string& css) {
web_frame_->document().insertStyleSheet(blink::WebString::fromUTF8(css));
web_frame_->GetDocument().InsertStyleSheet(blink::WebString::FromUTF8(css));
}
void WebFrame::ExecuteJavaScript(const base::string16& code,
@ -219,8 +219,8 @@ void WebFrame::ExecuteJavaScript(const base::string16& code,
args->GetNext(&completion_callback);
std::unique_ptr<blink::WebScriptExecutionCallback> callback(
new ScriptExecutionCallback(completion_callback));
web_frame_->requestExecuteScriptAndReturnValue(
blink::WebScriptSource(blink::WebString::fromUTF16(code)),
web_frame_->RequestExecuteScriptAndReturnValue(
blink::WebScriptSource(blink::WebString::FromUTF16(code)),
has_user_gesture,
callback.release());
}
@ -233,13 +233,13 @@ mate::Handle<WebFrame> WebFrame::Create(v8::Isolate* isolate) {
blink::WebCache::ResourceTypeStats WebFrame::GetResourceUsage(
v8::Isolate* isolate) {
blink::WebCache::ResourceTypeStats stats;
blink::WebCache::getResourceTypeStats(&stats);
blink::WebCache::GetResourceTypeStats(&stats);
return stats;
}
void WebFrame::ClearCache(v8::Isolate* isolate) {
isolate->IdleNotificationDeadline(0.5);
blink::WebCache::clear();
blink::WebCache::Clear();
base::MemoryPressureListener::NotifyMemoryPressure(
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL);
}

View file

@ -27,10 +27,10 @@ const size_t kMaxListSize = 512;
void GetDataListSuggestions(const blink::WebInputElement& element,
std::vector<base::string16>* values,
std::vector<base::string16>* labels) {
for (const auto& option : element.filteredDataListOptions()) {
values->push_back(option.value().utf16());
if (option.value() != option.label())
labels->push_back(option.label().utf16());
for (const auto& option : element.FilteredDataListOptions()) {
values->push_back(option.Value().Utf16());
if (option.Value() != option.Label())
labels->push_back(option.Label().Utf16());
else
labels->push_back(base::string16());
}
@ -56,7 +56,7 @@ AutofillAgent::AutofillAgent(
focused_node_was_last_clicked_(false),
was_focused_before_now_(false),
weak_ptr_factory_(this) {
render_frame()->GetWebFrame()->setAutofillClient(this);
render_frame()->GetWebFrame()->SetAutofillClient(this);
}
void AutofillAgent::OnDestruct() {
@ -73,34 +73,34 @@ void AutofillAgent::FocusedNodeChanged(const blink::WebNode&) {
HidePopup();
}
void AutofillAgent::textFieldDidEndEditing(
void AutofillAgent::TextFieldDidEndEditing(
const blink::WebInputElement&) {
HidePopup();
}
void AutofillAgent::textFieldDidChange(
void AutofillAgent::TextFieldDidChange(
const blink::WebFormControlElement& element) {
if (!IsUserGesture() && !render_frame()->IsPasting())
return;
weak_ptr_factory_.InvalidateWeakPtrs();
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&AutofillAgent::textFieldDidChangeImpl,
FROM_HERE, base::Bind(&AutofillAgent::TextFieldDidChangeImpl,
weak_ptr_factory_.GetWeakPtr(), element));
}
void AutofillAgent::textFieldDidChangeImpl(
void AutofillAgent::TextFieldDidChangeImpl(
const blink::WebFormControlElement& element) {
ShowSuggestionsOptions options;
options.requires_caret_at_end = true;
ShowSuggestions(element, options);
}
void AutofillAgent::textFieldDidReceiveKeyDown(
void AutofillAgent::TextFieldDidReceiveKeyDown(
const blink::WebInputElement& element,
const blink::WebKeyboardEvent& event) {
if (event.windowsKeyCode == ui::VKEY_DOWN ||
event.windowsKeyCode == ui::VKEY_UP) {
if (event.windows_key_code == ui::VKEY_DOWN ||
event.windows_key_code == ui::VKEY_UP) {
ShowSuggestionsOptions options;
options.autofill_on_empty_values = true;
options.requires_caret_at_end = true;
@ -108,16 +108,16 @@ void AutofillAgent::textFieldDidReceiveKeyDown(
}
}
void AutofillAgent::openTextDataListChooser(
void AutofillAgent::OpenTextDataListChooser(
const blink::WebInputElement& element) {
ShowSuggestionsOptions options;
options.autofill_on_empty_values = true;
ShowSuggestions(element, options);
}
void AutofillAgent::dataListOptionsChanged(
void AutofillAgent::DataListOptionsChanged(
const blink::WebInputElement& element) {
if (!element.focused())
if (!element.Focused())
return;
ShowSuggestionsOptions options;
@ -133,20 +133,20 @@ AutofillAgent::ShowSuggestionsOptions::ShowSuggestionsOptions()
void AutofillAgent::ShowSuggestions(
const blink::WebFormControlElement& element,
const ShowSuggestionsOptions& options) {
if (!element.isEnabled() || element.isReadOnly())
if (!element.IsEnabled() || element.IsReadOnly())
return;
const blink::WebInputElement* input_element = toWebInputElement(&element);
const blink::WebInputElement* input_element = ToWebInputElement(&element);
if (input_element) {
if (!input_element->isTextField())
if (!input_element->IsTextField())
return;
}
blink::WebString value = element.editingValue();
blink::WebString value = element.EditingValue();
if (value.length() > kMaxDataLength ||
(!options.autofill_on_empty_values && value.isEmpty()) ||
(!options.autofill_on_empty_values && value.IsEmpty()) ||
(options.requires_caret_at_end &&
(element.selectionStart() != element.selectionEnd() ||
element.selectionEnd() != static_cast<int>(value.length())))) {
(element.SelectionStart() != element.SelectionEnd() ||
element.SelectionEnd() != static_cast<int>(value.length())))) {
HidePopup();
return;
}
@ -169,7 +169,7 @@ AutofillAgent::Helper::Helper(AutofillAgent* agent)
}
void AutofillAgent::Helper::OnMouseDown(const blink::WebNode& node) {
agent_->focused_node_was_last_clicked_ = !node.isNull() && node.focused();
agent_->focused_node_was_last_clicked_ = !node.IsNull() && node.Focused();
}
void AutofillAgent::Helper::FocusChangeComplete() {
@ -188,7 +188,7 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
}
bool AutofillAgent::IsUserGesture() const {
return blink::WebUserGestureIndicator::isProcessingUserGesture();
return blink::WebUserGestureIndicator::IsProcessingUserGesture();
}
void AutofillAgent::HidePopup() {
@ -206,22 +206,22 @@ void AutofillAgent::ShowPopup(
}
void AutofillAgent::OnAcceptSuggestion(base::string16 suggestion) {
auto element = render_frame()->GetWebFrame()->document().focusedElement();
if (element.isFormControlElement()) {
toWebInputElement(&element)->setSuggestedValue(
blink::WebString::fromUTF16(suggestion));
auto element = render_frame()->GetWebFrame()->GetDocument().FocusedElement();
if (element.IsFormControlElement()) {
ToWebInputElement(&element)->SetSuggestedValue(
blink::WebString::FromUTF16(suggestion));
}
}
void AutofillAgent::DoFocusChangeComplete() {
auto element = render_frame()->GetWebFrame()->document().focusedElement();
if (element.isNull() || !element.isFormControlElement())
auto element = render_frame()->GetWebFrame()->GetDocument().FocusedElement();
if (element.IsNull() || !element.IsFormControlElement())
return;
if (focused_node_was_last_clicked_ && was_focused_before_now_) {
ShowSuggestionsOptions options;
options.autofill_on_empty_values = true;
auto input_element = toWebInputElement(&element);
auto input_element = ToWebInputElement(&element);
if (input_element)
ShowSuggestions(*input_element, options);
}

View file

@ -52,13 +52,13 @@ class AutofillAgent : public content::RenderFrameObserver,
bool OnMessageReceived(const IPC::Message& message) override;
// blink::WebAutofillClient:
void textFieldDidEndEditing(const blink::WebInputElement&) override;
void textFieldDidChange(const blink::WebFormControlElement&) override;
void textFieldDidChangeImpl(const blink::WebFormControlElement&);
void textFieldDidReceiveKeyDown(const blink::WebInputElement&,
void TextFieldDidEndEditing(const blink::WebInputElement&) override;
void TextFieldDidChange(const blink::WebFormControlElement&) override;
void TextFieldDidChangeImpl(const blink::WebFormControlElement&);
void TextFieldDidReceiveKeyDown(const blink::WebInputElement&,
const blink::WebKeyboardEvent&) override;
void openTextDataListChooser(const blink::WebInputElement&) override;
void dataListOptionsChanged(const blink::WebInputElement&) override;
void OpenTextDataListChooser(const blink::WebInputElement&) override;
void DataListOptionsChanged(const blink::WebInputElement&) override;
bool IsUserGesture() const;
void HidePopup();

View file

@ -51,17 +51,17 @@ void AtomRenderFrameObserver::CreateIsolatedWorldContext() {
// This maps to the name shown in the context combo box in the Console tab
// of the dev tools.
frame->setIsolatedWorldHumanReadableName(
frame->SetIsolatedWorldHumanReadableName(
World::ISOLATED_WORLD,
blink::WebString::fromUTF8("Electron Isolated Context"));
blink::WebString::FromUTF8("Electron Isolated Context"));
// Setup document's origin policy in isolated world
frame->setIsolatedWorldSecurityOrigin(
World::ISOLATED_WORLD, frame->document().getSecurityOrigin());
frame->SetIsolatedWorldSecurityOrigin(
World::ISOLATED_WORLD, frame->GetDocument().GetSecurityOrigin());
// Create initial script context in isolated world
blink::WebScriptSource source("void 0");
frame->executeScriptInIsolatedWorld(World::ISOLATED_WORLD, &source, 1);
frame->ExecuteScriptInIsolatedWorld(World::ISOLATED_WORLD, &source, 1);
}
bool AtomRenderFrameObserver::IsMainWorld(int world_id) {

View file

@ -87,10 +87,10 @@ AtomRenderViewObserver::~AtomRenderViewObserver() {
void AtomRenderViewObserver::EmitIPCEvent(blink::WebFrame* frame,
const base::string16& channel,
const base::ListValue& args) {
if (!frame || frame->isWebRemoteFrame())
if (!frame || frame->IsWebRemoteFrame())
return;
v8::Isolate* isolate = blink::mainThreadIsolate();
v8::Isolate* isolate = blink::MainThreadIsolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = renderer_client_->GetContext(frame, isolate);
@ -120,7 +120,7 @@ void AtomRenderViewObserver::DidCreateDocumentElement(
void AtomRenderViewObserver::DraggableRegionsChanged(blink::WebFrame* frame) {
blink::WebVector<blink::WebDraggableRegion> webregions =
frame->document().draggableRegions();
frame->GetDocument().DraggableRegions();
std::vector<DraggableRegion> regions;
for (auto& webregion : webregions) {
DraggableRegion region;
@ -156,22 +156,22 @@ void AtomRenderViewObserver::OnBrowserMessage(bool send_to_all,
if (!render_view()->GetWebView())
return;
blink::WebFrame* frame = render_view()->GetWebView()->mainFrame();
if (!frame || frame->isWebRemoteFrame())
blink::WebFrame* frame = render_view()->GetWebView()->MainFrame();
if (!frame || frame->IsWebRemoteFrame())
return;
EmitIPCEvent(frame, channel, args);
// Also send the message to all sub-frames.
if (send_to_all) {
for (blink::WebFrame* child = frame->firstChild(); child;
child = child->nextSibling())
for (blink::WebFrame* child = frame->FirstChild(); child;
child = child->NextSibling())
EmitIPCEvent(child, channel, args);
}
}
void AtomRenderViewObserver::OnOffscreen() {
blink::WebView::setUseExternalPopupMenus(false);
blink::WebView::SetUseExternalPopupMenus(false);
}
} // namespace atom

View file

@ -31,7 +31,7 @@ namespace atom {
namespace {
bool IsDevToolsExtension(content::RenderFrame* render_frame) {
return static_cast<GURL>(render_frame->GetWebFrame()->document().url())
return static_cast<GURL>(render_frame->GetWebFrame()->GetDocument().Url())
.SchemeIs("chrome-extension");
}
@ -174,9 +174,9 @@ void AtomRendererClient::WillDestroyWorkerContextOnWorkerThread(
v8::Local<v8::Context> AtomRendererClient::GetContext(
blink::WebFrame* frame, v8::Isolate* isolate) {
if (isolated_world())
return frame->worldScriptContext(isolate, World::ISOLATED_WORLD);
return frame->WorldScriptContext(isolate, World::ISOLATED_WORLD);
else
return frame->mainWorldScriptContext();
return frame->MainWorldScriptContext();
}
void AtomRendererClient::SetupMainWorldOverrides(

View file

@ -110,12 +110,12 @@ class AtomSandboxedRenderViewObserver : public AtomRenderViewObserver {
void EmitIPCEvent(blink::WebFrame* frame,
const base::string16& channel,
const base::ListValue& args) override {
if (!frame || frame->isWebRemoteFrame())
if (!frame || frame->IsWebRemoteFrame())
return;
auto isolate = blink::mainThreadIsolate();
auto isolate = blink::MainThreadIsolate();
v8::HandleScope handle_scope(isolate);
auto context = frame->mainWorldScriptContext();
auto context = frame->MainWorldScriptContext();
v8::Context::Scope context_scope(context);
v8::Local<v8::Value> argv[] = {
mate::ConvertToV8(isolate, channel),

View file

@ -14,45 +14,45 @@ namespace atom {
ContentSettingsObserver::ContentSettingsObserver(
content::RenderFrame* render_frame)
: content::RenderFrameObserver(render_frame) {
render_frame->GetWebFrame()->setContentSettingsClient(this);
render_frame->GetWebFrame()->SetContentSettingsClient(this);
}
ContentSettingsObserver::~ContentSettingsObserver() {
}
bool ContentSettingsObserver::allowDatabase(
bool ContentSettingsObserver::AllowDatabase(
const blink::WebString& name,
const blink::WebString& display_name,
unsigned estimated_size) {
blink::WebFrame* frame = render_frame()->GetWebFrame();
if (frame->getSecurityOrigin().isUnique() ||
frame->top()->getSecurityOrigin().isUnique())
if (frame->GetSecurityOrigin().IsUnique() ||
frame->Top()->GetSecurityOrigin().IsUnique())
return false;
auto origin = blink::WebStringToGURL(frame->getSecurityOrigin().toString());
auto origin = blink::WebStringToGURL(frame->GetSecurityOrigin().ToString());
if (!origin.IsStandard())
return false;
return true;
}
bool ContentSettingsObserver::allowStorage(bool local) {
bool ContentSettingsObserver::AllowStorage(bool local) {
blink::WebFrame* frame = render_frame()->GetWebFrame();
if (frame->getSecurityOrigin().isUnique() ||
frame->top()->getSecurityOrigin().isUnique())
if (frame->GetSecurityOrigin().IsUnique() ||
frame->Top()->GetSecurityOrigin().IsUnique())
return false;
auto origin = blink::WebStringToGURL(frame->getSecurityOrigin().toString());
auto origin = blink::WebStringToGURL(frame->GetSecurityOrigin().ToString());
if (!origin.IsStandard())
return false;
return true;
}
bool ContentSettingsObserver::allowIndexedDB(
bool ContentSettingsObserver::AllowIndexedDB(
const blink::WebString& name,
const blink::WebSecurityOrigin& security_origin) {
blink::WebFrame* frame = render_frame()->GetWebFrame();
if (frame->getSecurityOrigin().isUnique() ||
frame->top()->getSecurityOrigin().isUnique())
if (frame->GetSecurityOrigin().IsUnique() ||
frame->Top()->GetSecurityOrigin().IsUnique())
return false;
auto origin = blink::WebStringToGURL(frame->getSecurityOrigin().toString());
auto origin = blink::WebStringToGURL(frame->GetSecurityOrigin().ToString());
if (!origin.IsStandard())
return false;
return true;

View file

@ -18,11 +18,11 @@ class ContentSettingsObserver : public content::RenderFrameObserver,
~ContentSettingsObserver() override;
// blink::WebContentSettingsClient implementation.
bool allowDatabase(const blink::WebString& name,
bool AllowDatabase(const blink::WebString& name,
const blink::WebString& display_name,
unsigned estimated_size) override;
bool allowStorage(bool local) override;
bool allowIndexedDB(const blink::WebString& name,
bool AllowStorage(bool local) override;
bool AllowIndexedDB(const blink::WebString& name,
const blink::WebSecurityOrigin& security_origin) override;
private:

View file

@ -84,15 +84,15 @@ void RendererClientBase::AddRenderBindings(
}
void RendererClientBase::RenderThreadStarted() {
blink::WebCustomElement::addEmbedderCustomElementName("webview");
blink::WebCustomElement::addEmbedderCustomElementName("browserplugin");
blink::WebCustomElement::AddEmbedderCustomElementName("webview");
blink::WebCustomElement::AddEmbedderCustomElementName("browserplugin");
// Parse --secure-schemes=scheme1,scheme2
std::vector<std::string> secure_schemes_list =
ParseSchemesCLISwitch(switches::kSecureSchemes);
for (const std::string& scheme : secure_schemes_list)
blink::SchemeRegistry::registerURLSchemeAsSecure(
WTF::String::fromUTF8(scheme.data(), scheme.length()));
blink::SchemeRegistry::RegisterURLSchemeAsSecure(
WTF::String::FromUTF8(scheme.data(), scheme.length()));
preferences_manager_.reset(new PreferencesManager);
@ -128,13 +128,13 @@ void RendererClientBase::RenderFrameCreated(
// Allow file scheme to handle service worker by default.
// FIXME(zcbenz): Can this be moved elsewhere?
blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers("file");
blink::WebSecurityPolicy::RegisterURLSchemeAsAllowingServiceWorkers("file");
// This is required for widevine plugin detection provided during runtime.
blink::resetPluginCache();
blink::ResetPluginCache();
// Allow access to file scheme from pdf viewer.
blink::WebSecurityPolicy::addOriginAccessWhitelistEntry(
blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry(
GURL(kPdfViewerUIOrigin), "file", "", true);
}
@ -145,20 +145,20 @@ void RendererClientBase::RenderViewCreated(content::RenderView* render_view) {
base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
if (cmd->HasSwitch(switches::kGuestInstanceID)) { // webview.
web_frame_widget->setBaseBackgroundColor(SK_ColorTRANSPARENT);
web_frame_widget->SetBaseBackgroundColor(SK_ColorTRANSPARENT);
} else { // normal window.
// If backgroundColor is specified then use it.
std::string name = cmd->GetSwitchValueASCII(switches::kBackgroundColor);
// Otherwise use white background.
SkColor color = name.empty() ? SK_ColorWHITE : ParseHexColor(name);
web_frame_widget->setBaseBackgroundColor(color);
web_frame_widget->SetBaseBackgroundColor(color);
}
}
void RendererClientBase::DidClearWindowObject(
content::RenderFrame* render_frame) {
// Make sure every page will get a script context created.
render_frame->GetWebFrame()->executeScript(blink::WebScriptSource("void 0"));
render_frame->GetWebFrame()->ExecuteScript(blink::WebScriptSource("void 0"));
}
blink::WebSpeechSynthesizer* RendererClientBase::OverrideSpeechSynthesizer(
@ -172,8 +172,8 @@ bool RendererClientBase::OverrideCreatePlugin(
const blink::WebPluginParams& params,
blink::WebPlugin** plugin) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (params.mimeType.utf8() == content::kBrowserPluginMimeType ||
params.mimeType.utf8() == kPdfPluginMimeType ||
if (params.mime_type.Utf8() == content::kBrowserPluginMimeType ||
params.mime_type.Utf8() == kPdfPluginMimeType ||
command_line->HasSwitch(switches::kEnablePlugins))
return false;