Merge branch 'master' into chrome52

This commit is contained in:
Cheng Zhao 2016-07-21 05:34:36 -06:00
commit b57665330c
203 changed files with 2352 additions and 1220 deletions

View file

@ -11,6 +11,7 @@
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/browser.h"
#include "atom/browser/unresponsive_suppressor.h"
#include "atom/browser/window_list.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
@ -53,7 +54,6 @@ NativeWindow::NativeWindow(
transparent_(false),
enable_larger_than_screen_(false),
is_closed_(false),
has_dialog_attached_(false),
sheet_offset_x_(0.0),
sheet_offset_y_(0.0),
aspect_ratio_(0.0),
@ -210,7 +210,7 @@ gfx::Size NativeWindow::GetContentSize() {
void NativeWindow::SetSizeConstraints(
const extensions::SizeConstraints& window_constraints) {
extensions::SizeConstraints content_constraints;
extensions::SizeConstraints content_constraints(GetContentSizeConstraints());
if (window_constraints.HasMaximumSize())
content_constraints.set_maximum_size(
WindowSizeToContentSize(window_constraints.GetMaximumSize()));
@ -291,11 +291,7 @@ bool NativeWindow::IsDocumentEdited() {
void NativeWindow::SetFocusable(bool focusable) {
}
void NativeWindow::SetMenu(ui::MenuModel* menu) {
}
bool NativeWindow::HasModalDialog() {
return has_dialog_attached_;
void NativeWindow::SetMenu(AtomMenuModel* menu) {
}
void NativeWindow::SetParentWindow(NativeWindow* parent) {
@ -315,39 +311,6 @@ bool NativeWindow::IsWebViewFocused() {
return host_view && host_view->HasFocus();
}
void NativeWindow::CapturePage(const gfx::Rect& rect,
const CapturePageCallback& callback) {
const auto view = web_contents()->GetRenderWidgetHostView();
const auto host = view ? view->GetRenderWidgetHost() : nullptr;
if (!view || !host) {
callback.Run(SkBitmap());
return;
}
// Capture full page if user doesn't specify a |rect|.
const gfx::Size view_size = rect.IsEmpty() ? view->GetViewBounds().size() :
rect.size();
// By default, the requested bitmap size is the view size in screen
// coordinates. However, if there's more pixel detail available on the
// current system, increase the requested bitmap size to capture it all.
gfx::Size bitmap_size = view_size;
const gfx::NativeView native_view = view->GetNativeView();
const float scale =
display::Screen::GetScreen()->GetDisplayNearestWindow(native_view)
.device_scale_factor();
if (scale > 1.0f)
bitmap_size = gfx::ScaleToCeiledSize(view_size, scale);
host->CopyFromBackingStore(
gfx::Rect(rect.origin(), view_size),
bitmap_size,
base::Bind(&NativeWindow::OnCapturePageDone,
weak_factory_.GetWeakPtr(),
callback),
kBGRA_8888_SkColorType);
}
void NativeWindow::SetAutoHideMenuBar(bool auto_hide) {
}
@ -624,7 +587,7 @@ void NativeWindow::ScheduleUnresponsiveEvent(int ms) {
void NativeWindow::NotifyWindowUnresponsive() {
window_unresposive_closure_.Cancel();
if (!is_closed_ && !HasModalDialog() && IsEnabled())
if (!is_closed_ && !IsUnresponsiveEventSuppressed() && IsEnabled())
FOR_EACH_OBSERVER(NativeWindowObserver,
observers_,
OnRendererUnresponsive());
@ -634,10 +597,4 @@ void NativeWindow::NotifyReadyToShow() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnReadyToShow());
}
void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback,
const SkBitmap& bitmap,
content::ReadbackResponse response) {
callback.Run(bitmap);
}
} // namespace atom