Merge pull request #3716 from atom/chrome47-win

Port Chrome47 on Windows
This commit is contained in:
Cheng Zhao 2015-12-08 09:52:50 +08:00
commit ac2e500cf7
8 changed files with 27 additions and 25 deletions

View file

@ -127,7 +127,7 @@ void Browser::SetUserTasks(const std::vector<UserTask>& tasks) {
PCWSTR Browser::GetAppUserModelID() {
if (app_user_model_id_.empty()) {
SetAppUserModelID(ReplaceStringPlaceholders(
SetAppUserModelID(base::ReplaceStringPlaceholders(
kAppUserModelIDFormat, base::UTF8ToUTF16(GetName()), nullptr));
}

View file

@ -51,7 +51,7 @@ void ConvertFilters(const Filters& filters,
std::vector<std::string> extensions(filter.second);
for (size_t j = 0; j < extensions.size(); ++j)
extensions[j].insert(0, "*.");
buffer->push_back(base::UTF8ToWide(JoinString(extensions, ";")));
buffer->push_back(base::UTF8ToWide(base::JoinString(extensions, ";")));
spec.pszSpec = buffer->back().c_str();
filterspec->push_back(spec);
@ -273,7 +273,9 @@ bool ShowSaveDialog(atom::NativeWindow* parent_window,
bool matched = false;
for (size_t i = 0; i < filter.second.size(); ++i) {
if (filter.second[i] == "*" ||
base::EndsWith(file_name, filter.second[i], false)) {
base::EndsWith(
file_name, filter.second[i],
base::CompareCase::INSENSITIVE_ASCII)) {
matched = true;
break;;
}

View file

@ -153,9 +153,9 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
return;
}
base::string16 pipe_name = ReplaceStringPlaceholders(
base::string16 pipe_name = base::ReplaceStringPlaceholders(
kPipeNameFormat, base::UTF8ToUTF16(product_name), NULL);
base::string16 wait_name = ReplaceStringPlaceholders(
base::string16 wait_name = base::ReplaceStringPlaceholders(
kWaitEventFormat, base::UTF8ToUTF16(product_name), NULL);
// Wait until the crash service is started.

View file

@ -118,7 +118,7 @@ HWND g_top_window = NULL;
bool CreateTopWindow(HINSTANCE instance,
const base::string16& application_name,
bool visible) {
base::string16 class_name = ReplaceStringPlaceholders(
base::string16 class_name = base::ReplaceStringPlaceholders(
kClassNameFormat, application_name, NULL);
WNDCLASSEXW wcx = {0};
@ -309,7 +309,7 @@ bool CrashService::Initialize(const base::string16& application_name,
// Create or open an event to signal the browser process that the crash
// service is initialized.
base::string16 wait_name = ReplaceStringPlaceholders(
base::string16 wait_name = base::ReplaceStringPlaceholders(
kWaitEventFormat, application_name, NULL);
HANDLE wait_event = ::CreateEventW(NULL, TRUE, TRUE, wait_name.c_str());
::SetEvent(wait_event);
@ -524,4 +524,3 @@ PSECURITY_DESCRIPTOR CrashService::GetSecurityDescriptorForLowIntegrity() {
}
} // namespace breakpad

View file

@ -68,7 +68,7 @@ int Main(const wchar_t* cmd) {
VLOG(1) << "Session start. cmdline is [" << cmd << "]";
// Setting the crash reporter.
base::string16 pipe_name = ReplaceStringPlaceholders(kPipeNameFormat,
base::string16 pipe_name = base::ReplaceStringPlaceholders(kPipeNameFormat,
application_name,
NULL);
cmd_line.AppendSwitch("no-window");

View file

@ -15,26 +15,26 @@
class TtsPlatformImplWin : public TtsPlatformImpl {
public:
virtual bool PlatformImplAvailable() {
bool PlatformImplAvailable() override {
return true;
}
virtual bool Speak(
bool Speak(
int utterance_id,
const std::string& utterance,
const std::string& lang,
const VoiceData& voice,
const UtteranceContinuousParameters& params);
const UtteranceContinuousParameters& params) override;
virtual bool StopSpeaking();
bool StopSpeaking() override;
virtual void Pause();
void Pause() override;
virtual void Resume();
void Resume() override;
virtual bool IsSpeaking();
bool IsSpeaking() override;
virtual void GetVoices(std::vector<VoiceData>* out_voices) override;
void GetVoices(std::vector<VoiceData>* out_voices) override;
// Get the single instance of this class.
static TtsPlatformImplWin* GetInstance();
@ -43,7 +43,7 @@ class TtsPlatformImplWin : public TtsPlatformImpl {
private:
TtsPlatformImplWin();
virtual ~TtsPlatformImplWin() {}
~TtsPlatformImplWin() override {}
void OnSpeechEvent();
@ -57,7 +57,7 @@ class TtsPlatformImplWin : public TtsPlatformImpl {
int char_position_;
bool paused_;
friend struct DefaultSingletonTraits<TtsPlatformImplWin>;
friend struct base::DefaultSingletonTraits<TtsPlatformImplWin>;
DISALLOW_COPY_AND_ASSIGN(TtsPlatformImplWin);
};
@ -220,6 +220,8 @@ void TtsPlatformImplWin::OnSpeechEvent() {
utterance_id_, TTS_EVENT_SENTENCE, char_position_,
std::string());
break;
default:
break;
}
}
}
@ -246,12 +248,12 @@ TtsPlatformImplWin::TtsPlatformImplWin()
// static
TtsPlatformImplWin* TtsPlatformImplWin::GetInstance() {
return Singleton<TtsPlatformImplWin,
LeakySingletonTraits<TtsPlatformImplWin> >::get();
return base::Singleton<TtsPlatformImplWin,
base::LeakySingletonTraits<TtsPlatformImplWin>>::get();
}
// static
void TtsPlatformImplWin::SpeechEventCallback(
WPARAM w_param, LPARAM l_param) {
GetInstance()->OnSpeechEvent();
}
}

View file

@ -135,7 +135,6 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
printed_page_params.page_size = page_size_in_dpi[i];
printed_page_params.content_area = content_area_in_dpi[i];
Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params));
printed_page_params.metafile_data_handle = INVALID_HANDLE_VALUE;
}
return true;
}

View file

@ -228,7 +228,7 @@ void StreamListenSocket::CloseSocket() {
void StreamListenSocket::WatchSocket(WaitState state) {
#if defined(OS_WIN)
WSAEventSelect(socket_, socket_event_, FD_ACCEPT | FD_CLOSE | FD_READ);
watcher_.StartWatching(socket_event_, this);
watcher_.StartWatchingOnce(socket_event_, this);
#elif defined(OS_POSIX)
// Implicitly calls StartWatchingFileDescriptor().
base::MessageLoopForIO::current()->WatchFileDescriptor(
@ -264,7 +264,7 @@ void StreamListenSocket::OnObjectSignaled(HANDLE object) {
return;
}
// The object was reset by WSAEnumNetworkEvents. Watch for the next signal.
watcher_.StartWatching(object, this);
watcher_.StartWatchingOnce(object, this);
if (ev.lNetworkEvents == 0) {
// Occasionally the event is set even though there is no new data.