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() { PCWSTR Browser::GetAppUserModelID() {
if (app_user_model_id_.empty()) { if (app_user_model_id_.empty()) {
SetAppUserModelID(ReplaceStringPlaceholders( SetAppUserModelID(base::ReplaceStringPlaceholders(
kAppUserModelIDFormat, base::UTF8ToUTF16(GetName()), nullptr)); kAppUserModelIDFormat, base::UTF8ToUTF16(GetName()), nullptr));
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -15,26 +15,26 @@
class TtsPlatformImplWin : public TtsPlatformImpl { class TtsPlatformImplWin : public TtsPlatformImpl {
public: public:
virtual bool PlatformImplAvailable() { bool PlatformImplAvailable() override {
return true; return true;
} }
virtual bool Speak( bool Speak(
int utterance_id, int utterance_id,
const std::string& utterance, const std::string& utterance,
const std::string& lang, const std::string& lang,
const VoiceData& voice, 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. // Get the single instance of this class.
static TtsPlatformImplWin* GetInstance(); static TtsPlatformImplWin* GetInstance();
@ -43,7 +43,7 @@ class TtsPlatformImplWin : public TtsPlatformImpl {
private: private:
TtsPlatformImplWin(); TtsPlatformImplWin();
virtual ~TtsPlatformImplWin() {} ~TtsPlatformImplWin() override {}
void OnSpeechEvent(); void OnSpeechEvent();
@ -57,7 +57,7 @@ class TtsPlatformImplWin : public TtsPlatformImpl {
int char_position_; int char_position_;
bool paused_; bool paused_;
friend struct DefaultSingletonTraits<TtsPlatformImplWin>; friend struct base::DefaultSingletonTraits<TtsPlatformImplWin>;
DISALLOW_COPY_AND_ASSIGN(TtsPlatformImplWin); DISALLOW_COPY_AND_ASSIGN(TtsPlatformImplWin);
}; };
@ -220,6 +220,8 @@ void TtsPlatformImplWin::OnSpeechEvent() {
utterance_id_, TTS_EVENT_SENTENCE, char_position_, utterance_id_, TTS_EVENT_SENTENCE, char_position_,
std::string()); std::string());
break; break;
default:
break;
} }
} }
} }
@ -246,8 +248,8 @@ TtsPlatformImplWin::TtsPlatformImplWin()
// static // static
TtsPlatformImplWin* TtsPlatformImplWin::GetInstance() { TtsPlatformImplWin* TtsPlatformImplWin::GetInstance() {
return Singleton<TtsPlatformImplWin, return base::Singleton<TtsPlatformImplWin,
LeakySingletonTraits<TtsPlatformImplWin> >::get(); base::LeakySingletonTraits<TtsPlatformImplWin>>::get();
} }
// static // static

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.page_size = page_size_in_dpi[i];
printed_page_params.content_area = content_area_in_dpi[i]; printed_page_params.content_area = content_area_in_dpi[i];
Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params)); Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params));
printed_page_params.metafile_data_handle = INVALID_HANDLE_VALUE;
} }
return true; return true;
} }

View file

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