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

@ -107,7 +107,8 @@ void SecurityStateTabHelper::VisibleSecurityStateChanged() {
void SecurityStateTabHelper::DidStartNavigation(
content::NavigationHandle* navigation_handle) {
if (time_of_http_warning_on_current_navigation_.is_null() ||
!navigation_handle->IsInMainFrame() || navigation_handle->IsSamePage()) {
!navigation_handle->IsInMainFrame() ||
navigation_handle->IsSameDocument()) {
return;
}
// Record how quickly a user leaves a site after encountering an
@ -126,7 +127,8 @@ void SecurityStateTabHelper::DidStartNavigation(
void SecurityStateTabHelper::DidFinishNavigation(
content::NavigationHandle* navigation_handle) {
if (navigation_handle->IsInMainFrame() && !navigation_handle->IsSamePage()) {
if (navigation_handle->IsInMainFrame() &&
!navigation_handle->IsSameDocument()) {
// Only reset the console message flag for main-frame navigations,
// and not for same-page navigations like reference fragments and pushState.
logged_http_warning_on_current_navigation_ = false;

View file

@ -22,7 +22,7 @@ PrintMsg_Print_Params::PrintMsg_Print_Params()
preview_ui_id(-1),
preview_request_id(0),
is_first_request(false),
print_scaling_option(blink::WebPrintScalingOptionSourceSize),
print_scaling_option(blink::kWebPrintScalingOptionSourceSize),
print_to_pdf(false),
display_header_footer(false),
title(),
@ -48,7 +48,7 @@ void PrintMsg_Print_Params::Reset() {
preview_ui_id = -1;
preview_request_id = 0;
is_first_request = false;
print_scaling_option = blink::WebPrintScalingOptionSourceSize;
print_scaling_option = blink::kWebPrintScalingOptionSourceSize;
print_to_pdf = false;
display_header_footer = false;
title = base::string16();

View file

@ -79,7 +79,7 @@ IPC_ENUM_TRAITS_MIN_MAX_VALUE(printing::DuplexMode,
printing::UNKNOWN_DUPLEX_MODE,
printing::SHORT_EDGE)
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebPrintScalingOption,
blink::WebPrintScalingOptionLast)
blink::kWebPrintScalingOptionLast)
// Parameters for a render request.
IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params)

View file

@ -96,7 +96,7 @@ PrintMsg_Print_Params GetCssPrintParams(
dpi, kPixelsPerInch);
if (frame) {
frame->pageSizeAndMarginsInPixels(page_index,
frame->PageSizeAndMarginsInPixels(page_index,
page_size_in_pixels,
margin_top_in_pixels,
margin_right_in_pixels,
@ -104,9 +104,9 @@ PrintMsg_Print_Params GetCssPrintParams(
margin_left_in_pixels);
}
double new_content_width = page_size_in_pixels.width() -
double new_content_width = page_size_in_pixels.Width() -
margin_left_in_pixels - margin_right_in_pixels;
double new_content_height = page_size_in_pixels.height() -
double new_content_height = page_size_in_pixels.Height() -
margin_top_in_pixels - margin_bottom_in_pixels;
// Invalid page size and/or margins. We just use the default setting.
@ -117,8 +117,8 @@ PrintMsg_Print_Params GetCssPrintParams(
}
page_css_params.page_size =
gfx::Size(ConvertUnit(page_size_in_pixels.width(), kPixelsPerInch, dpi),
ConvertUnit(page_size_in_pixels.height(), kPixelsPerInch, dpi));
gfx::Size(ConvertUnit(page_size_in_pixels.Width(), kPixelsPerInch, dpi),
ConvertUnit(page_size_in_pixels.Height(), kPixelsPerInch, dpi));
page_css_params.content_size =
gfx::Size(ConvertUnit(new_content_width, kPixelsPerInch, dpi),
ConvertUnit(new_content_height, kPixelsPerInch, dpi));
@ -214,53 +214,53 @@ void ComputeWebKitPrintParamsInDesiredDpi(
const PrintMsg_Print_Params& print_params,
blink::WebPrintParams* webkit_print_params) {
int dpi = GetDPI(&print_params);
webkit_print_params->printerDPI = dpi;
webkit_print_params->printScalingOption = print_params.print_scaling_option;
webkit_print_params->printer_dpi = dpi;
webkit_print_params->print_scaling_option = print_params.print_scaling_option;
webkit_print_params->printContentArea.width =
webkit_print_params->print_content_area.width =
ConvertUnit(print_params.content_size.width(), dpi,
print_params.desired_dpi);
webkit_print_params->printContentArea.height =
webkit_print_params->print_content_area.height =
ConvertUnit(print_params.content_size.height(), dpi,
print_params.desired_dpi);
webkit_print_params->printableArea.x =
webkit_print_params->printable_area.x =
ConvertUnit(print_params.printable_area.x(), dpi,
print_params.desired_dpi);
webkit_print_params->printableArea.y =
webkit_print_params->printable_area.y =
ConvertUnit(print_params.printable_area.y(), dpi,
print_params.desired_dpi);
webkit_print_params->printableArea.width =
webkit_print_params->printable_area.width =
ConvertUnit(print_params.printable_area.width(), dpi,
print_params.desired_dpi);
webkit_print_params->printableArea.height =
webkit_print_params->printable_area.height =
ConvertUnit(print_params.printable_area.height(),
dpi, print_params.desired_dpi);
webkit_print_params->paperSize.width =
webkit_print_params->paper_size.width =
ConvertUnit(print_params.page_size.width(), dpi,
print_params.desired_dpi);
webkit_print_params->paperSize.height =
webkit_print_params->paper_size.height =
ConvertUnit(print_params.page_size.height(), dpi,
print_params.desired_dpi);
}
blink::WebPlugin* GetPlugin(const blink::WebFrame* frame) {
return frame->document().isPluginDocument() ?
frame->document().to<blink::WebPluginDocument>().plugin() : NULL;
return frame->GetDocument().IsPluginDocument() ?
frame->GetDocument().To<blink::WebPluginDocument>().Plugin() : NULL;
}
bool PrintingNodeOrPdfFrame(const blink::WebFrame* frame,
const blink::WebNode& node) {
if (!node.isNull())
if (!node.IsNull())
return true;
blink::WebPlugin* plugin = GetPlugin(frame);
return plugin && plugin->supportsPaginatedPrint();
return plugin && plugin->SupportsPaginatedPrint();
}
MarginType GetMarginsForPdf(blink::WebFrame* frame,
const blink::WebNode& node) {
if (frame->isPrintScalingDisabledForPlugin(node))
if (frame->IsPrintScalingDisabledForPlugin(node))
return NO_MARGINS;
else
return PRINTABLE_AREA_MARGINS;
@ -324,7 +324,7 @@ FrameReference::~FrameReference() {
void FrameReference::Reset(blink::WebLocalFrame* frame) {
if (frame) {
view_ = frame->view();
view_ = frame->View();
frame_ = frame;
} else {
view_ = NULL;
@ -335,8 +335,8 @@ void FrameReference::Reset(blink::WebLocalFrame* frame) {
blink::WebLocalFrame* FrameReference::GetFrame() {
if (view_ == NULL || frame_ == NULL)
return NULL;
for (blink::WebFrame* frame = view_->mainFrame(); frame != NULL;
frame = frame->traverseNext()) {
for (blink::WebFrame* frame = view_->MainFrame(); frame != NULL;
frame = frame->TraverseNext()) {
if (frame == frame_)
return frame_;
}
@ -357,7 +357,7 @@ float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame,
SkAutoCanvasRestore auto_restore(canvas, true);
canvas->translate((content_area.x() - canvas_area.x()) / scale_factor,
(content_area.y() - canvas_area.y()) / scale_factor);
return frame->printPage(page_number, canvas);
return frame->PrintPage(page_number, canvas);
}
// Class that calls the Begin and End print functions on the frame and changes
@ -395,16 +395,16 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
bool IsLoadingSelection() {
// It's not selection if not |owns_web_view_|.
return owns_web_view_ && frame() && frame()->isLoading();
return owns_web_view_ && frame() && frame()->IsLoading();
}
protected:
// blink::WebViewClient override:
void didStopLoading() override;
bool allowsBrokenNullLayerTreeView() const override;
void DidStopLoading() override;
bool AllowsBrokenNullLayerTreeView() const override;
// blink::WebFrameClient:
blink::WebLocalFrame* createChildFrame(
blink::WebLocalFrame* CreateChildFrame(
blink::WebLocalFrame* parent,
blink::WebTreeScopeType scope,
const blink::WebString& name,
@ -453,13 +453,13 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
!PrintingNodeOrPdfFrame(frame, node_to_print_)) {
bool fit_to_page = ignore_css_margins &&
print_params.print_scaling_option ==
blink::WebPrintScalingOptionFitToPrintableArea;
blink::kWebPrintScalingOptionFitToPrintableArea;
ComputeWebKitPrintParamsInDesiredDpi(params, &web_print_params_);
frame->printBegin(web_print_params_, node_to_print_);
frame->PrintBegin(web_print_params_, node_to_print_);
print_params = CalculatePrintParamsForCss(frame, 0, print_params,
ignore_css_margins, fit_to_page,
NULL);
frame->printEnd();
frame->PrintEnd();
}
ComputeWebKitPrintParamsInDesiredDpi(print_params, &web_print_params_);
}
@ -475,8 +475,8 @@ void PrepareFrameAndViewForPrint::ResizeForPrinting() {
// minimum (default) scaling.
// This is important for sites that try to fill the page.
// The 1.25 value is |printingMinimumShrinkFactor|.
gfx::Size print_layout_size(web_print_params_.printContentArea.width,
web_print_params_.printContentArea.height);
gfx::Size print_layout_size(web_print_params_.print_content_area.width,
web_print_params_.print_content_area.height);
print_layout_size.set_height(
static_cast<int>(static_cast<double>(print_layout_size.height()) * 1.25));
@ -485,22 +485,22 @@ void PrepareFrameAndViewForPrint::ResizeForPrinting() {
// Backup size and offset if it's a local frame.
blink::WebView* web_view = frame_.view();
if (blink::WebFrame* web_frame = web_view->mainFrame()) {
if (web_frame->isWebLocalFrame())
prev_scroll_offset_ = web_frame->getScrollOffset();
if (blink::WebFrame* web_frame = web_view->MainFrame()) {
if (web_frame->IsWebLocalFrame())
prev_scroll_offset_ = web_frame->GetScrollOffset();
}
prev_view_size_ = web_view->size();
prev_view_size_ = web_view->Size();
web_view->resize(print_layout_size);
web_view->Resize(print_layout_size);
}
void PrepareFrameAndViewForPrint::StartPrinting() {
ResizeForPrinting();
blink::WebView* web_view = frame_.view();
web_view->settings()->setShouldPrintBackgrounds(should_print_backgrounds_);
web_view->GetSettings()->SetShouldPrintBackgrounds(should_print_backgrounds_);
expected_pages_count_ =
frame()->printBegin(web_print_params_, node_to_print_);
frame()->PrintBegin(web_print_params_, node_to_print_);
is_printing_started_ = true;
}
@ -521,7 +521,7 @@ void PrepareFrameAndViewForPrint::CopySelection(
ResizeForPrinting();
std::string url_str = "data:text/html;charset=utf-8,";
url_str.append(
net::EscapeQueryParamValue(frame()->selectionAsMarkup().utf8(), false));
net::EscapeQueryParamValue(frame()->SelectionAsMarkup().Utf8(), false));
RestoreSize();
// Create a new WebView with the same settings as the current display one.
// Except that we disable javascript (don't want any active content running
@ -530,44 +530,44 @@ void PrepareFrameAndViewForPrint::CopySelection(
prefs.javascript_enabled = false;
blink::WebView* web_view =
blink::WebView::create(this, blink::WebPageVisibilityStateVisible);
blink::WebView::Create(this, blink::kWebPageVisibilityStateVisible);
owns_web_view_ = true;
content::RenderView::ApplyWebPreferences(prefs, web_view);
blink::WebLocalFrame* main_frame = blink::WebLocalFrame::create(
blink::WebTreeScopeType::Document, this, nullptr, nullptr);
web_view->setMainFrame(main_frame);
blink::WebFrameWidget::create(this, web_view, main_frame);
frame_.Reset(web_view->mainFrame()->toWebLocalFrame());
node_to_print_.reset();
blink::WebLocalFrame* main_frame = blink::WebLocalFrame::Create(
blink::WebTreeScopeType::kDocument, this, nullptr, nullptr);
web_view->SetMainFrame(main_frame);
blink::WebFrameWidget::Create(this, web_view, main_frame);
frame_.Reset(web_view->MainFrame()->ToWebLocalFrame());
node_to_print_.Reset();
// When loading is done this will call didStopLoading() and that will do the
// When loading is done this will call DidStopLoading() and that will do the
// actual printing.
frame()->loadRequest(blink::WebURLRequest(GURL(url_str)));
frame()->LoadRequest(blink::WebURLRequest(GURL(url_str)));
}
bool PrepareFrameAndViewForPrint::allowsBrokenNullLayerTreeView() const {
bool PrepareFrameAndViewForPrint::AllowsBrokenNullLayerTreeView() const {
return true;
}
void PrepareFrameAndViewForPrint::didStopLoading() {
void PrepareFrameAndViewForPrint::DidStopLoading() {
DCHECK(!on_ready_.is_null());
// Don't call callback here, because it can delete |this| and WebView that is
// called didStopLoading.
// called DidStopLoading.
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&PrepareFrameAndViewForPrint::CallOnReady,
weak_ptr_factory_.GetWeakPtr()));
}
blink::WebLocalFrame* PrepareFrameAndViewForPrint::createChildFrame(
blink::WebLocalFrame* PrepareFrameAndViewForPrint::CreateChildFrame(
blink::WebLocalFrame* parent,
blink::WebTreeScopeType scope,
const blink::WebString& name,
const blink::WebString& unique_name,
blink::WebSandboxFlags sandbox_flags,
const blink::WebFrameOwnerProperties& frame_owner_properties) {
blink::WebLocalFrame* frame = blink::WebLocalFrame::create(
blink::WebLocalFrame* frame = blink::WebLocalFrame::Create(
scope, this, nullptr, nullptr);
parent->appendChild(frame);
parent->AppendChild(frame);
return frame;
}
@ -579,30 +579,30 @@ void PrepareFrameAndViewForPrint::RestoreSize() {
if (!frame())
return;
blink::WebView* web_view = frame_.GetFrame()->view();
web_view->resize(prev_view_size_);
if (blink::WebFrame* web_frame = web_view->mainFrame()) {
if (web_frame->isWebLocalFrame())
web_frame->setScrollOffset(prev_scroll_offset_);
blink::WebView* web_view = frame_.GetFrame()->View();
web_view->Resize(prev_view_size_);
if (blink::WebFrame* web_frame = web_view->MainFrame()) {
if (web_frame->IsWebLocalFrame())
web_frame->SetScrollOffset(prev_scroll_offset_);
}
}
void PrepareFrameAndViewForPrint::FinishPrinting() {
blink::WebLocalFrame* frame = frame_.GetFrame();
if (frame) {
blink::WebView* web_view = frame->view();
blink::WebView* web_view = frame->View();
if (is_printing_started_) {
is_printing_started_ = false;
frame->printEnd();
frame->PrintEnd();
if (!owns_web_view_) {
web_view->settings()->setShouldPrintBackgrounds(false);
web_view->GetSettings()->SetShouldPrintBackgrounds(false);
RestoreSize();
}
}
if (owns_web_view_) {
DCHECK(!frame->isLoading());
DCHECK(!frame->IsLoading());
owns_web_view_ = false;
web_view->close();
web_view->Close();
}
}
frame_.Reset(NULL);
@ -825,7 +825,7 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() {
}
void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
if (node.isNull() || !node.document().frame()) {
if (node.IsNull() || !node.GetDocument().GetFrame()) {
// This can occur when the context menu refers to an invalid WebNode.
// See http://crbug.com/100890#c17 for a repro case.
return;
@ -840,7 +840,7 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
print_node_in_progress_ = true;
blink::WebNode duplicate_node(node);
Print(duplicate_node.document().frame(), duplicate_node);
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node);
print_node_in_progress_ = false;
}
@ -988,7 +988,7 @@ void PrintWebViewHelper::ComputePageLayoutInPointsForCss(
PrintMsg_Print_Params params = CalculatePrintParamsForCss(
frame, page_index, page_params, ignore_css_margins,
page_params.print_scaling_option ==
blink::WebPrintScalingOptionFitToPrintableArea,
blink::kWebPrintScalingOptionFitToPrintableArea,
scale_factor);
CalculatePageLayoutFromPrintParams(params, page_layout_in_points);
}
@ -1015,10 +1015,10 @@ bool PrintWebViewHelper::InitPrintSettings(bool fit_to_paper_size,
settings.pages.clear();
settings.params.print_scaling_option =
blink::WebPrintScalingOptionSourceSize;
blink::kWebPrintScalingOptionSourceSize;
if (fit_to_paper_size) {
settings.params.print_scaling_option =
blink::WebPrintScalingOptionFitToPrintableArea;
blink::kWebPrintScalingOptionFitToPrintableArea;
}
SetPrintPagesParams(settings);
@ -1092,7 +1092,7 @@ bool PrintWebViewHelper::UpdatePrintSettings(
settings.params.print_to_pdf = true;
UpdateFrameMarginsCssInfo(*job_settings);
settings.params.print_scaling_option =
blink::WebPrintScalingOptionSourceSize;
blink::kWebPrintScalingOptionSourceSize;
}
SetPrintPagesParams(settings);
@ -1114,7 +1114,7 @@ bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebLocalFrame* frame,
PrintMsg_PrintPages_Params print_settings;
params.cookie = print_pages_params_->params.document_cookie;
params.has_selection = frame->hasSelection();
params.has_selection = frame->HasSelection();
params.expected_pages_count = expected_pages_count;
MarginType margin_type = DEFAULT_MARGINS;
if (PrintingNodeOrPdfFrame(frame, node))
@ -1225,16 +1225,16 @@ void PrintWebViewHelper::PrintPreviewContext::InitWithFrame(
DCHECK(!IsRendering());
state_ = INITIALIZED;
source_frame_.Reset(web_frame);
source_node_.reset();
source_node_.Reset();
}
void PrintWebViewHelper::PrintPreviewContext::InitWithNode(
const blink::WebNode& web_node) {
DCHECK(!web_node.isNull());
DCHECK(web_node.document().frame());
DCHECK(!web_node.IsNull());
DCHECK(web_node.GetDocument().GetFrame());
DCHECK(!IsRendering());
state_ = INITIALIZED;
source_frame_.Reset(web_node.document().frame());
source_frame_.Reset(web_node.GetDocument().GetFrame());
source_node_ = web_node;
}
@ -1367,7 +1367,7 @@ bool PrintWebViewHelper::PrintPreviewContext::IsModifiable() {
}
bool PrintWebViewHelper::PrintPreviewContext::HasSelection() {
return IsModifiable() && source_frame()->hasSelection();
return IsModifiable() && source_frame()->HasSelection();
}
bool PrintWebViewHelper::PrintPreviewContext::IsLastPageOfPrintReadyMetafile()

View file

@ -94,7 +94,7 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
gfx::Size* page_size,
gfx::Rect* content_rect) {
double scale_factor = 1.0f;
double webkit_shrink_factor = frame->getPrintPageShrink(page_number);
double webkit_shrink_factor = frame->GetPrintPageShrink(page_number);
PageSizeMargins page_layout_in_points;
gfx::Rect content_area;

View file

@ -52,35 +52,35 @@ bool TtsDispatcher::OnControlMessageReceived(const IPC::Message& message) {
return false;
}
void TtsDispatcher::updateVoiceList() {
void TtsDispatcher::UpdateVoiceList() {
RenderThread::Get()->Send(new TtsHostMsg_InitializeVoiceList());
}
void TtsDispatcher::speak(const WebSpeechSynthesisUtterance& web_utterance) {
void TtsDispatcher::Speak(const WebSpeechSynthesisUtterance& web_utterance) {
int id = next_utterance_id_++;
utterance_id_map_[id] = web_utterance;
TtsUtteranceRequest utterance;
utterance.id = id;
utterance.text = web_utterance.text().utf8();
utterance.lang = web_utterance.lang().utf8();
utterance.voice = web_utterance.voice().utf8();
utterance.volume = web_utterance.volume();
utterance.rate = web_utterance.rate();
utterance.pitch = web_utterance.pitch();
utterance.text = web_utterance.GetText().Utf8();
utterance.lang = web_utterance.Lang().Utf8();
utterance.voice = web_utterance.Voice().Utf8();
utterance.volume = web_utterance.Volume();
utterance.rate = web_utterance.Rate();
utterance.pitch = web_utterance.Pitch();
RenderThread::Get()->Send(new TtsHostMsg_Speak(utterance));
}
void TtsDispatcher::pause() {
void TtsDispatcher::Pause() {
RenderThread::Get()->Send(new TtsHostMsg_Pause());
}
void TtsDispatcher::resume() {
void TtsDispatcher::Resume() {
RenderThread::Get()->Send(new TtsHostMsg_Resume());
}
void TtsDispatcher::cancel() {
void TtsDispatcher::Cancel() {
RenderThread::Get()->Send(new TtsHostMsg_Cancel());
}
@ -96,13 +96,13 @@ void TtsDispatcher::OnSetVoiceList(const std::vector<TtsVoice>& voices) {
WebVector<WebSpeechSynthesisVoice> out_voices(voices.size());
for (size_t i = 0; i < voices.size(); ++i) {
out_voices[i] = WebSpeechSynthesisVoice();
out_voices[i].setVoiceURI(WebString::fromUTF8(voices[i].voice_uri));
out_voices[i].setName(WebString::fromUTF8(voices[i].name));
out_voices[i].setLanguage(WebString::fromUTF8(voices[i].lang));
out_voices[i].setIsLocalService(voices[i].local_service);
out_voices[i].setIsDefault(voices[i].is_default);
out_voices[i].SetVoiceURI(WebString::FromUTF8(voices[i].voice_uri));
out_voices[i].SetName(WebString::FromUTF8(voices[i].name));
out_voices[i].SetLanguage(WebString::FromUTF8(voices[i].lang));
out_voices[i].SetIsLocalService(voices[i].local_service);
out_voices[i].SetIsDefault(voices[i].is_default);
}
synthesizer_client_->setVoiceList(out_voices);
synthesizer_client_->SetVoiceList(out_voices);
}
void TtsDispatcher::OnDidStartSpeaking(int utterance_id) {
@ -110,45 +110,45 @@ void TtsDispatcher::OnDidStartSpeaking(int utterance_id) {
return;
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull())
if (utterance.IsNull())
return;
synthesizer_client_->didStartSpeaking(utterance);
synthesizer_client_->DidStartSpeaking(utterance);
}
void TtsDispatcher::OnDidFinishSpeaking(int utterance_id) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull())
if (utterance.IsNull())
return;
synthesizer_client_->didFinishSpeaking(utterance);
synthesizer_client_->DidFinishSpeaking(utterance);
utterance_id_map_.erase(utterance_id);
}
void TtsDispatcher::OnDidPauseSpeaking(int utterance_id) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull())
if (utterance.IsNull())
return;
synthesizer_client_->didPauseSpeaking(utterance);
synthesizer_client_->DidPauseSpeaking(utterance);
}
void TtsDispatcher::OnDidResumeSpeaking(int utterance_id) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull())
if (utterance.IsNull())
return;
synthesizer_client_->didResumeSpeaking(utterance);
synthesizer_client_->DidResumeSpeaking(utterance);
}
void TtsDispatcher::OnWordBoundary(int utterance_id, int char_index) {
CHECK(char_index >= 0);
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull())
if (utterance.IsNull())
return;
synthesizer_client_->wordBoundaryEventOccurred(
synthesizer_client_->WordBoundaryEventOccurred(
utterance, static_cast<unsigned>(char_index));
}
@ -156,10 +156,10 @@ void TtsDispatcher::OnSentenceBoundary(int utterance_id, int char_index) {
CHECK(char_index >= 0);
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull())
if (utterance.IsNull())
return;
synthesizer_client_->sentenceBoundaryEventOccurred(
synthesizer_client_->SentenceBoundaryEventOccurred(
utterance, static_cast<unsigned>(char_index));
}
@ -169,31 +169,31 @@ void TtsDispatcher::OnMarkerEvent(int utterance_id, int char_index) {
void TtsDispatcher::OnWasInterrupted(int utterance_id) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull())
if (utterance.IsNull())
return;
// The web speech API doesn't support "interrupted".
synthesizer_client_->didFinishSpeaking(utterance);
synthesizer_client_->DidFinishSpeaking(utterance);
utterance_id_map_.erase(utterance_id);
}
void TtsDispatcher::OnWasCancelled(int utterance_id) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull())
if (utterance.IsNull())
return;
// The web speech API doesn't support "cancelled".
synthesizer_client_->didFinishSpeaking(utterance);
synthesizer_client_->DidFinishSpeaking(utterance);
utterance_id_map_.erase(utterance_id);
}
void TtsDispatcher::OnSpeakingErrorOccurred(int utterance_id,
const std::string& error_message) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull())
if (utterance.IsNull())
return;
// The web speech API doesn't support an error message.
synthesizer_client_->speakingErrorOccurred(utterance);
synthesizer_client_->SpeakingErrorOccurred(utterance);
utterance_id_map_.erase(utterance_id);
}

View file

@ -38,12 +38,12 @@ class TtsDispatcher
virtual bool OnControlMessageReceived(const IPC::Message& message) override;
// blink::WebSpeechSynthesizer implementation.
virtual void updateVoiceList() override;
virtual void speak(const blink::WebSpeechSynthesisUtterance& utterance)
virtual void UpdateVoiceList() override;
virtual void Speak(const blink::WebSpeechSynthesisUtterance& utterance)
override;
virtual void pause() override;
virtual void resume() override;
virtual void cancel() override;
virtual void Pause() override;
virtual void Resume() override;
virtual void Cancel() override;
blink::WebSpeechSynthesisUtterance FindUtterance(int utterance_id);