summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2013-08-06 11:01:04 +0100
committerBen Murdoch <benm@google.com>2013-08-06 11:01:04 +0100
commit2385ea399aae016c0806a4f9ef3c9cfe3d2a39df (patch)
treee910e76d19265ff3230c473da95410d3f3a007af /ui
parent8ee924b76946696c0f52e56d28cc5ab741919041 (diff)
downloadchromium_org-2385ea399aae016c0806a4f9ef3c9cfe3d2a39df.tar.gz
Merge from Chromium at DEPS revision r215849
This commit was generated by merge_to_master.py. Change-Id: I225a31651af894e33bdd71e7121702bcbe5310f4
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/OWNERS4
-rw-r--r--ui/aura/aura.gyp2
-rw-r--r--ui/aura/root_window.cc10
-rw-r--r--ui/aura/root_window.h7
-rw-r--r--ui/aura/window.cc13
-rw-r--r--ui/aura/window_destruction_observer.cc25
-rw-r--r--ui/aura/window_destruction_observer.h46
-rw-r--r--ui/base/OWNERS1
-rw-r--r--ui/base/accessibility/OWNERS1
-rw-r--r--ui/base/cursor/cursor_loader_x11.cc87
-rw-r--r--ui/base/cursor/cursor_loader_x11.h10
-rw-r--r--ui/base/cursor/cursor_loader_x11_unittest.cc57
-rw-r--r--ui/base/ime/win/tsf_input_scope.cc21
-rw-r--r--ui/base/latency_info_unittest.cc142
-rw-r--r--ui/base/range/OWNERS1
-rw-r--r--ui/base/strings/OWNERS1
-rw-r--r--ui/base/text/OWNERS1
-rw-r--r--ui/gl/gl.gyp8
-rw-r--r--ui/keyboard/resources/webui_index.html1
-rw-r--r--ui/message_center/cocoa/notification_controller.mm37
-rw-r--r--ui/message_center/cocoa/tray_view_controller.mm7
-rw-r--r--ui/message_center/message_center_style.h7
-rw-r--r--ui/message_center/message_center_tray_delegate.h6
-rw-r--r--ui/message_center/message_center_tray_unittest.cc4
-rw-r--r--ui/message_center/views/message_center_bubble.cc7
-rw-r--r--ui/message_center/views/message_center_bubble.h5
-rw-r--r--ui/message_center/views/message_center_view.cc29
-rw-r--r--ui/message_center/views/message_center_view.h6
-rw-r--r--ui/message_center/views/message_popup_collection.cc32
-rw-r--r--ui/message_center/views/notification_view.cc43
-rw-r--r--ui/ui_unittests.gypi6
-rw-r--r--ui/views/ime/input_method_bridge.cc5
-rw-r--r--ui/views/widget/desktop_aura/OWNERS5
-rw-r--r--ui/views/widget/widget.cc4
-rw-r--r--ui/views/window/dialog_delegate_unittest.cc72
-rw-r--r--ui/webui/resources/js/cr/ui/overlay.js7
36 files changed, 497 insertions, 223 deletions
diff --git a/ui/aura/OWNERS b/ui/aura/OWNERS
index 3b48ffc2da..447142eb55 100644
--- a/ui/aura/OWNERS
+++ b/ui/aura/OWNERS
@@ -1,2 +1,6 @@
ben@chromium.org
sky@chromium.org
+sadrul@chromium.org
+
+per-file *x11.cc=erg@chromium.org
+per-file *x11.h=erg@chromium.org
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp
index 7915d09107..a4fe8612de 100644
--- a/ui/aura/aura.gyp
+++ b/ui/aura/aura.gyp
@@ -101,8 +101,6 @@
'window.cc',
'window.h',
'window_delegate.h',
- 'window_destruction_observer.cc',
- 'window_destruction_observer.h',
'window_observer.h',
'window_tracker.cc',
'window_tracker.h',
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 3df23c5eef..43366f001a 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -353,7 +353,7 @@ bool RootWindow::DispatchGestureEvent(ui::GestureEvent* event) {
void RootWindow::OnWindowDestroying(Window* window) {
DispatchMouseExitToHidingWindow(window);
- OnWindowHidden(window, WINDOW_DESTROYED, NULL);
+ OnWindowHidden(window, WINDOW_DESTROYED);
if (window->IsVisible() &&
window->ContainsPointInRoot(GetLastMouseLocationInRoot())) {
@@ -389,7 +389,7 @@ void RootWindow::DispatchMouseExitToHidingWindow(Window* window) {
void RootWindow::OnWindowVisibilityChanged(Window* window, bool is_visible) {
if (!is_visible)
- OnWindowHidden(window, WINDOW_HIDDEN, NULL);
+ OnWindowHidden(window, WINDOW_HIDDEN);
if (window->ContainsPointInRoot(GetLastMouseLocationInRoot()))
PostMouseMoveEventAfterWindowChange();
@@ -788,7 +788,7 @@ void RootWindow::OnWindowRemovedFromRootWindow(Window* detached,
DCHECK(aura::client::GetCaptureWindow(this) != this);
DispatchMouseExitToHidingWindow(detached);
- OnWindowHidden(detached, new_root ? WINDOW_MOVING : WINDOW_HIDDEN, new_root);
+ OnWindowHidden(detached, new_root ? WINDOW_MOVING : WINDOW_HIDDEN);
if (detached->IsVisible() &&
detached->ContainsPointInRoot(GetLastMouseLocationInRoot())) {
@@ -796,9 +796,7 @@ void RootWindow::OnWindowRemovedFromRootWindow(Window* detached,
}
}
-void RootWindow::OnWindowHidden(Window* invisible,
- WindowHiddenReason reason,
- RootWindow* new_root) {
+void RootWindow::OnWindowHidden(Window* invisible, WindowHiddenReason reason) {
// TODO(beng): This should be removed once FocusController is turned on.
if (client::GetFocusClient(this)) {
client::GetFocusClient(this)->OnWindowHiddenInRootWindow(
diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h
index 0e40d8a2f5..e8a6b260f8 100644
--- a/ui/aura/root_window.h
+++ b/ui/aura/root_window.h
@@ -338,11 +338,8 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate,
// Called when a window becomes invisible, either by being removed
// from root window hierarchy, via SetVisible(false) or being destroyed.
- // |reason| specifies what triggered the hiding. |new_root| is the new root
- // window, and may be NULL.
- void OnWindowHidden(Window* invisible,
- WindowHiddenReason reason,
- RootWindow* new_root);
+ // |reason| specifies what triggered the hiding.
+ void OnWindowHidden(Window* invisible, WindowHiddenReason reason);
// Cleans up the gesture recognizer for all windows in |window| (including
// |window| itself).
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index e3960fc05d..e5289e46a2 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -23,8 +23,8 @@
#include "ui/aura/layout_manager.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window_delegate.h"
-#include "ui/aura/window_destruction_observer.h"
#include "ui/aura/window_observer.h"
+#include "ui/aura/window_tracker.h"
#include "ui/base/animation/multi_animation.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/layer.h"
@@ -1027,13 +1027,14 @@ void Window::NotifyWindowVisibilityChanged(aura::Window* target,
bool Window::NotifyWindowVisibilityChangedAtReceiver(aura::Window* target,
bool visible) {
- // |this| may be deleted during a call to OnWindowVisibilityChanged
- // on one of the observers. We create an local observer for that. In
- // that case we exit without further access to any members.
- WindowDestructionObserver destruction_observer(this);
+ // |this| may be deleted during a call to OnWindowVisibilityChanged() on one
+ // of the observers. We create an local observer for that. In that case we
+ // exit without further access to any members.
+ WindowTracker tracker;
+ tracker.Add(this);
FOR_EACH_OBSERVER(WindowObserver, observers_,
OnWindowVisibilityChanged(target, visible));
- return !destruction_observer.destroyed();
+ return tracker.Contains(this);
}
bool Window::NotifyWindowVisibilityChangedDown(aura::Window* target,
diff --git a/ui/aura/window_destruction_observer.cc b/ui/aura/window_destruction_observer.cc
deleted file mode 100644
index 20325c7bc5..0000000000
--- a/ui/aura/window_destruction_observer.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/aura/window_destruction_observer.h"
-
-namespace aura {
-
-WindowDestructionObserver::WindowDestructionObserver(Window* window)
- : window_(window), destroyed_(false) {
- DCHECK(window_);
- window_->AddObserver(this);
-}
-
-WindowDestructionObserver::~WindowDestructionObserver() {
- if (!destroyed_)
- window_->RemoveObserver(this);
-}
-
-void WindowDestructionObserver::OnWindowDestroyed(Window* window) {
- if (window == window_)
- destroyed_ = true;
-}
-
-} // namespace aura
diff --git a/ui/aura/window_destruction_observer.h b/ui/aura/window_destruction_observer.h
deleted file mode 100644
index ef0ded6581..0000000000
--- a/ui/aura/window_destruction_observer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_AURA_WINDOW_DESTRUCTION_OBSERVER_H_
-#define UI_AURA_WINDOW_DESTRUCTION_OBSERVER_H_
-
-#include <set>
-
-#include "ui/aura/aura_export.h"
-#include "ui/aura/window.h"
-#include "ui/aura/window_observer.h"
-
-namespace aura {
-
-// A class for observing window (self) destruction. A side effect of a
-// window member funtion may be that the object, i.e. |this|, gets
-// deleted. This class can be used to detect such cases and to exit
-// the member function without any further access to member data. See
-// for example: aura::Window::NotifyWindowVisibilityChangedAtReceiver.
-
-class AURA_EXPORT WindowDestructionObserver : public WindowObserver {
- public:
- // Addes this observer to window.
- explicit WindowDestructionObserver(aura::Window* window);
-
- // Removes this observer from |window_| unless |window_| has been
- // observed to be destroyed.
- virtual ~WindowDestructionObserver();
-
- // Returns true if |window_| has been observed to be destroyed.
- bool destroyed() const { return destroyed_; }
-
- private:
- // aura::WindowObserver overrides:
- virtual void OnWindowDestroyed(Window* window) OVERRIDE;
-
- Window* window_;
- bool destroyed_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowDestructionObserver);
-};
-
-} // namespace aura
-
-#endif
diff --git a/ui/base/OWNERS b/ui/base/OWNERS
index 5ff0082652..e5fb424e37 100644
--- a/ui/base/OWNERS
+++ b/ui/base/OWNERS
@@ -1 +1,2 @@
per-file latency_info.*=jbauman@chromium.org
+per-file latency_info_unittest.cc=jbauman@chromium.org
diff --git a/ui/base/accessibility/OWNERS b/ui/base/accessibility/OWNERS
new file mode 100644
index 0000000000..c32e059845
--- /dev/null
+++ b/ui/base/accessibility/OWNERS
@@ -0,0 +1 @@
+dmazzoni@chromium.org
diff --git a/ui/base/cursor/cursor_loader_x11.cc b/ui/base/cursor/cursor_loader_x11.cc
index 8d9f36fe0f..e30b24cfb3 100644
--- a/ui/base/cursor/cursor_loader_x11.cc
+++ b/ui/base/cursor/cursor_loader_x11.cc
@@ -137,25 +137,6 @@ int CursorShapeFromNative(const gfx::NativeCursor& native_cursor) {
return XC_left_ptr;
}
-void ScaleCursorImageAndHotpoint(float scale,
- SkBitmap* bitmap,
- gfx::Point* hotpoint) {
- if (scale < FLT_EPSILON) {
- NOTREACHED() << "Scale must be larger than 0.";
- scale = 1.0f;
- }
-
- gfx::Size scaled_size = gfx::ToFlooredSize(
- gfx::ScaleSize(gfx::Size(bitmap->width(), bitmap->height()), scale));
-
- *bitmap = skia::ImageOperations::Resize(
- *bitmap,
- skia::ImageOperations::RESIZE_BETTER,
- scaled_size.width(),
- scaled_size.height());
- *hotpoint = gfx::ToFlooredPoint(gfx::ScalePoint(*hotpoint, scale));
-}
-
} // namespace
namespace ui {
@@ -181,28 +162,8 @@ void CursorLoaderX11::LoadImageCursor(int id,
GetScaleFactorFromScale(display().device_scale_factor()));
SkBitmap bitmap = image_rep.sk_bitmap();
gfx::Point hotpoint = hot;
- switch (display().rotation()) {
- case gfx::Display::ROTATE_0:
- break;
- case gfx::Display::ROTATE_90:
- hotpoint.SetPoint(bitmap.height() - hot.y(), hot.x());
- bitmap = SkBitmapOperations::Rotate(
- bitmap, SkBitmapOperations::ROTATION_90_CW);
- break;
- case gfx::Display::ROTATE_180:
- hotpoint.SetPoint(bitmap.width() - hot.x(), bitmap.height() - hot.y());
- bitmap = SkBitmapOperations::Rotate(
- bitmap, SkBitmapOperations::ROTATION_180_CW);
- break;
- case gfx::Display::ROTATE_270:
- hotpoint.SetPoint(hot.y(), bitmap.width() - hot.x());
- bitmap = SkBitmapOperations::Rotate(
- bitmap, SkBitmapOperations::ROTATION_270_CW);
- break;
- }
-
- if (scale() != 1.f)
- ScaleCursorImageAndHotpoint(scale(), &bitmap, &hotpoint);
+ ScaleAndRotateCursorBitmapAndHotpoint(
+ scale(), display().rotation(), &bitmap, &hotpoint);
XcursorImage* x_image = SkBitmapToXcursorImage(&bitmap, hotpoint);
cursors_[id] = CreateReffedCustomXCursor(x_image);
@@ -298,4 +259,48 @@ bool CursorLoaderX11::IsImageCursor(gfx::NativeCursor native_cursor) {
return GetXCursor(CursorShapeFromNative(native_cursor));
}
+void ScaleAndRotateCursorBitmapAndHotpoint(float scale,
+ gfx::Display::Rotation rotation,
+ SkBitmap* bitmap,
+ gfx::Point* hotpoint) {
+ switch (rotation) {
+ case gfx::Display::ROTATE_0:
+ break;
+ case gfx::Display::ROTATE_90:
+ hotpoint->SetPoint(bitmap->height() - hotpoint->y(), hotpoint->x());
+ *bitmap = SkBitmapOperations::Rotate(
+ *bitmap, SkBitmapOperations::ROTATION_90_CW);
+ break;
+ case gfx::Display::ROTATE_180:
+ hotpoint->SetPoint(
+ bitmap->width() - hotpoint->x(), bitmap->height() - hotpoint->y());
+ *bitmap = SkBitmapOperations::Rotate(
+ *bitmap, SkBitmapOperations::ROTATION_180_CW);
+ break;
+ case gfx::Display::ROTATE_270:
+ hotpoint->SetPoint(hotpoint->y(), bitmap->width() - hotpoint->x());
+ *bitmap = SkBitmapOperations::Rotate(
+ *bitmap, SkBitmapOperations::ROTATION_270_CW);
+ break;
+ }
+
+ if (scale < FLT_EPSILON) {
+ NOTREACHED() << "Scale must be larger than 0.";
+ scale = 1.0f;
+ }
+
+ if (scale == 1.0f)
+ return;
+
+ gfx::Size scaled_size = gfx::ToFlooredSize(
+ gfx::ScaleSize(gfx::Size(bitmap->width(), bitmap->height()), scale));
+
+ *bitmap = skia::ImageOperations::Resize(
+ *bitmap,
+ skia::ImageOperations::RESIZE_BETTER,
+ scaled_size.width(),
+ scaled_size.height());
+ *hotpoint = gfx::ToFlooredPoint(gfx::ScalePoint(*hotpoint, scale));
+}
+
} // namespace ui
diff --git a/ui/base/cursor/cursor_loader_x11.h b/ui/base/cursor/cursor_loader_x11.h
index 4947ca00e1..a0265ffe3a 100644
--- a/ui/base/cursor/cursor_loader_x11.h
+++ b/ui/base/cursor/cursor_loader_x11.h
@@ -13,6 +13,7 @@
#include "ui/base/cursor/cursor_loader.h"
#include "ui/base/ui_export.h"
#include "ui/base/x/x11_util.h"
+#include "ui/gfx/display.h"
namespace ui {
@@ -55,6 +56,15 @@ class UI_EXPORT CursorLoaderX11 : public CursorLoader {
DISALLOW_COPY_AND_ASSIGN(CursorLoaderX11);
};
+// Scale and rotate the cursor's bitmap and hotpoint.
+// |bitmap_in_out| and |hotpoint_in_out| are used as
+// both input and output.
+UI_EXPORT void ScaleAndRotateCursorBitmapAndHotpoint(
+ float scale,
+ gfx::Display::Rotation rotation,
+ SkBitmap* bitmap_in_out,
+ gfx::Point* hotpoint_in_out);
+
} // namespace ui
#endif // UI_BASE_CURSOR_CURSOR_LOADER_X11_H_
diff --git a/ui/base/cursor/cursor_loader_x11_unittest.cc b/ui/base/cursor/cursor_loader_x11_unittest.cc
new file mode 100644
index 0000000000..c2413b6acf
--- /dev/null
+++ b/ui/base/cursor/cursor_loader_x11_unittest.cc
@@ -0,0 +1,57 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/base/cursor/cursor_loader_x11.h"
+
+#undef None
+#undef Bool
+
+#include "base/logging.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+namespace ui {
+
+TEST(CursorLoaderX11Test, ScaleAndRotate) {
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 5);
+ bitmap.allocPixels();
+
+ gfx::Point hotpoint(3,4);
+
+ ScaleAndRotateCursorBitmapAndHotpoint(1.0f,
+ gfx::Display::ROTATE_0,
+ &bitmap,
+ &hotpoint);
+ EXPECT_EQ(10, bitmap.width());
+ EXPECT_EQ(5, bitmap.height());
+ EXPECT_EQ("3,4", hotpoint.ToString());
+
+ ScaleAndRotateCursorBitmapAndHotpoint(1.0f,
+ gfx::Display::ROTATE_90,
+ &bitmap,
+ &hotpoint);
+
+ EXPECT_EQ(5, bitmap.width());
+ EXPECT_EQ(10, bitmap.height());
+ EXPECT_EQ("1,3", hotpoint.ToString());
+
+ ScaleAndRotateCursorBitmapAndHotpoint(2.0f,
+ gfx::Display::ROTATE_180,
+ &bitmap,
+ &hotpoint);
+ EXPECT_EQ(10, bitmap.width());
+ EXPECT_EQ(20, bitmap.height());
+ EXPECT_EQ("8,14", hotpoint.ToString());
+
+ ScaleAndRotateCursorBitmapAndHotpoint(1.0f,
+ gfx::Display::ROTATE_270,
+ &bitmap,
+ &hotpoint);
+ EXPECT_EQ(20, bitmap.width());
+ EXPECT_EQ(10, bitmap.height());
+ EXPECT_EQ("14,2", hotpoint.ToString());
+}
+
+} // namespace ui
diff --git a/ui/base/ime/win/tsf_input_scope.cc b/ui/base/ime/win/tsf_input_scope.cc
index dac701b0a8..01529812b6 100644
--- a/ui/base/ime/win/tsf_input_scope.cc
+++ b/ui/base/ime/win/tsf_input_scope.cc
@@ -5,6 +5,7 @@
#include "ui/base/ime/win/tsf_input_scope.h"
#include <InputScope.h>
+#include <vector>
#include "base/compiler_specific.h"
#include "base/logging.h"
@@ -16,8 +17,8 @@ namespace {
class TSFInputScope : public ITfInputScope {
public:
- explicit TSFInputScope(InputScope input_scope)
- : input_scope_(input_scope),
+ explicit TSFInputScope(const std::vector<InputScope>& input_scopes)
+ : input_scopes_(input_scopes),
ref_count_(0) {}
// ITfInputScope:
@@ -51,13 +52,15 @@ class TSFInputScope : public ITfInputScope {
if (!count || !input_scopes)
return E_INVALIDARG;
*input_scopes = static_cast<InputScope*>(CoTaskMemAlloc(
- sizeof(InputScope)));
+ sizeof(InputScope) * input_scopes_.size()));
if (!input_scopes) {
*count = 0;
return E_OUTOFMEMORY;
}
- (*input_scopes)[0] = input_scope_;
- *count = 1;
+
+ for (size_t i = 0; i < input_scopes_.size(); ++i)
+ (*input_scopes)[i] = input_scopes_[i];
+ *count = input_scopes_.size();
return S_OK;
}
@@ -78,8 +81,8 @@ class TSFInputScope : public ITfInputScope {
}
private:
- // The corresponding text input type.
- InputScope input_scope_;
+ // The corresponding text input types.
+ std::vector<InputScope> input_scopes_;
// The refrence count of this instance.
volatile LONG ref_count_;
@@ -136,7 +139,9 @@ InputScope GetInputScopeType(TextInputType text_input_type) {
} // namespace
ITfInputScope* CreateInputScope(TextInputType text_input_type) {
- return new TSFInputScope(GetInputScopeType(text_input_type));
+ std::vector<InputScope> input_scopes(1);
+ input_scopes.push_back(GetInputScopeType(text_input_type));
+ return new TSFInputScope(input_scopes);
}
void SetInputScopeForTsfUnawareWindow(HWND window_handle,
diff --git a/ui/base/latency_info_unittest.cc b/ui/base/latency_info_unittest.cc
new file mode 100644
index 0000000000..bb834787d3
--- /dev/null
+++ b/ui/base/latency_info_unittest.cc
@@ -0,0 +1,142 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/base/latency_info.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace ui {
+
+TEST(LatencyInfoTest, AddTwoSeparateEvent) {
+ LatencyInfo info;
+ info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
+ 0,
+ 1,
+ base::TimeTicks::FromInternalValue(100),
+ 1);
+ info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
+ 1,
+ 5,
+ base::TimeTicks::FromInternalValue(1000),
+ 2);
+
+ EXPECT_EQ(info.latency_components.size(), 2u);
+ LatencyInfo::LatencyComponent component;
+ EXPECT_FALSE(
+ info.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
+ EXPECT_FALSE(
+ info.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 1, &component));
+ EXPECT_TRUE(
+ info.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 0, &component));
+ EXPECT_EQ(component.sequence_number, 1);
+ EXPECT_EQ(component.event_count, 1u);
+ EXPECT_EQ(component.event_time.ToInternalValue(), 100);
+ EXPECT_TRUE(
+ info.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1, &component));
+ EXPECT_EQ(component.sequence_number, 5);
+ EXPECT_EQ(component.event_count, 2u);
+ EXPECT_EQ(component.event_time.ToInternalValue(), 1000);
+}
+
+TEST(LatencyInfoTest, AddTwoSameEvent) {
+ LatencyInfo info;
+ info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
+ 0,
+ 30,
+ base::TimeTicks::FromInternalValue(100),
+ 2);
+ info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
+ 0,
+ 13,
+ base::TimeTicks::FromInternalValue(200),
+ 3);
+
+ EXPECT_EQ(info.latency_components.size(), 1u);
+ LatencyInfo::LatencyComponent component;
+ EXPECT_FALSE(
+ info.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
+ EXPECT_FALSE(
+ info.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 1, &component));
+ EXPECT_TRUE(
+ info.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 0, &component));
+ EXPECT_EQ(component.sequence_number, 30);
+ EXPECT_EQ(component.event_count, 5u);
+ EXPECT_EQ(component.event_time.ToInternalValue(), (100 * 2 + 200 * 3) / 5);
+}
+
+TEST(LatencyInfoTest, MergeTwoSeparateEvent) {
+ LatencyInfo info1;
+ LatencyInfo info2;
+ info1.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
+ 0,
+ 1,
+ base::TimeTicks::FromInternalValue(100),
+ 1);
+ info2.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
+ 1,
+ 5,
+ base::TimeTicks::FromInternalValue(1000),
+ 2);
+ info1.MergeWith(info2);
+
+ EXPECT_EQ(info1.latency_components.size(), 2u);
+ LatencyInfo::LatencyComponent component;
+ EXPECT_FALSE(
+ info1.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
+ EXPECT_FALSE(
+ info1.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 1, &component));
+ EXPECT_TRUE(
+ info1.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 0, &component));
+ EXPECT_EQ(component.sequence_number, 1);
+ EXPECT_EQ(component.event_count, 1u);
+ EXPECT_EQ(component.event_time.ToInternalValue(), 100);
+ EXPECT_TRUE(
+ info1.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1, &component));
+ EXPECT_EQ(component.sequence_number, 5);
+ EXPECT_EQ(component.event_count, 2u);
+ EXPECT_EQ(component.event_time.ToInternalValue(), 1000);
+}
+
+TEST(LatencyInfoTest, MergeTwoSameEvent) {
+ LatencyInfo info1;
+ LatencyInfo info2;
+ info1.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
+ 0,
+ 30,
+ base::TimeTicks::FromInternalValue(100),
+ 2);
+ info2.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
+ 0,
+ 13,
+ base::TimeTicks::FromInternalValue(200),
+ 3);
+ info1.MergeWith(info2);
+
+ EXPECT_EQ(info1.latency_components.size(), 1u);
+ LatencyInfo::LatencyComponent component;
+ EXPECT_FALSE(
+ info1.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
+ EXPECT_FALSE(
+ info1.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 1, &component));
+ EXPECT_TRUE(
+ info1.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 0, &component));
+ EXPECT_EQ(component.sequence_number, 30);
+ EXPECT_EQ(component.event_count, 5u);
+ EXPECT_EQ(component.event_time.ToInternalValue(), (100 * 2 + 200 * 3) / 5);
+}
+
+TEST(LatencyInfoTest, ClearEvents) {
+ LatencyInfo info;
+ info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
+ 0,
+ 30,
+ base::TimeTicks::FromInternalValue(100),
+ 2);
+
+ EXPECT_EQ(info.latency_components.size(), 1u);
+ info.Clear();
+ EXPECT_EQ(info.latency_components.size(), 0u);
+}
+
+} // namespace ui
diff --git a/ui/base/range/OWNERS b/ui/base/range/OWNERS
new file mode 100644
index 0000000000..14fce2ae68
--- /dev/null
+++ b/ui/base/range/OWNERS
@@ -0,0 +1 @@
+rsesek@chromium.org
diff --git a/ui/base/strings/OWNERS b/ui/base/strings/OWNERS
new file mode 100644
index 0000000000..72e8ffc0db
--- /dev/null
+++ b/ui/base/strings/OWNERS
@@ -0,0 +1 @@
+*
diff --git a/ui/base/text/OWNERS b/ui/base/text/OWNERS
new file mode 100644
index 0000000000..b9e8da980e
--- /dev/null
+++ b/ui/base/text/OWNERS
@@ -0,0 +1 @@
+asvitkine@chromium.org
diff --git a/ui/gl/gl.gyp b/ui/gl/gl.gyp
index 02a19637fd..940578beeb 100644
--- a/ui/gl/gl.gyp
+++ b/ui/gl/gl.gyp
@@ -133,13 +133,7 @@
'action_name': 'generate_gl_bindings',
'variables': {
'generator_path': 'generate_bindings.py',
- 'conditions': [
- ['use_system_mesa==0', {
- 'header_paths': '../../third_party/mesa/src/include:../../third_party/khronos',
- }, { # use_system_mesa==1
- 'header_paths': '/usr/include',
- }],
- ],
+ 'header_paths': '../../third_party/mesa/src/include:../../third_party/khronos',
},
'inputs': [
'<(generator_path)',
diff --git a/ui/keyboard/resources/webui_index.html b/ui/keyboard/resources/webui_index.html
index cc3566c191..48b1637571 100644
--- a/ui/keyboard/resources/webui_index.html
+++ b/ui/keyboard/resources/webui_index.html
@@ -15,6 +15,7 @@
<html>
<head>
<meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<link rel="stylesheet" href="main.css">
<script src="constants.js"></script>
<script src="polymer.min.js"></script>
diff --git a/ui/message_center/cocoa/notification_controller.mm b/ui/message_center/cocoa/notification_controller.mm
index dbbbbf59eb..4a36ee6e3e 100644
--- a/ui/message_center/cocoa/notification_controller.mm
+++ b/ui/message_center/cocoa/notification_controller.mm
@@ -19,12 +19,6 @@
#include "ui/message_center/message_center_style.h"
#include "ui/message_center/notification.h"
-const CGFloat kProgressBarThickness = 8;
-const CGFloat kProgressBarTopPadding = 12;
-const SkColor kProgressBarBackgroundColor = SkColorSetRGB(230, 230, 230);
-const SkColor kProgressBarBackgroundBorderColor = SkColorSetRGB(208, 208, 208);
-const SkColor kProgressBarSliceColor = SkColorSetRGB(78, 156, 245);
-const SkColor kProgressBarSliceBorderColor = SkColorSetRGB(110, 188, 249);
@interface MCNotificationProgressBar : NSProgressIndicator
@end
@@ -37,17 +31,21 @@ const SkColor kProgressBarSliceBorderColor = SkColorSetRGB(110, 188, 249);
NSDivideRect(dirtyRect, &sliceRect, &remainderRect,
NSWidth(dirtyRect) * progressFraction, NSMinXEdge);
- // For slice part.
- [gfx::SkColorToCalibratedNSColor(kProgressBarSliceBorderColor)
- drawSwatchInRect:sliceRect];
- [gfx::SkColorToCalibratedNSColor(kProgressBarSliceColor)
- drawSwatchInRect:NSInsetRect(sliceRect, 1.0, 1.0)];
-
- // For remainder part.
- [gfx::SkColorToCalibratedNSColor(kProgressBarBackgroundBorderColor)
- drawSwatchInRect:remainderRect];
- [gfx::SkColorToCalibratedNSColor(kProgressBarBackgroundColor)
- drawSwatchInRect:NSInsetRect(remainderRect, 1.0, 1.0)];
+ NSBezierPath* path = [NSBezierPath bezierPathWithRoundedRect:dirtyRect
+ xRadius:message_center::kProgressBarCornerRadius
+ yRadius:message_center::kProgressBarCornerRadius];
+ [gfx::SkColorToCalibratedNSColor(message_center::kProgressBarBackgroundColor)
+ set];
+ [path fill];
+
+ if (progressFraction == 0.0)
+ return;
+
+ path = [NSBezierPath bezierPathWithRoundedRect:sliceRect
+ xRadius:message_center::kProgressBarCornerRadius
+ yRadius:message_center::kProgressBarCornerRadius];
+ [gfx::SkColorToCalibratedNSColor(message_center::kProgressBarSliceColor) set];
+ [path fill];
}
@end
@@ -364,8 +362,9 @@ const SkColor kProgressBarSliceBorderColor = SkColorSetRGB(110, 188, 249);
if (notification->type() == message_center::NOTIFICATION_TYPE_PROGRESS) {
progressBarFrame = [self currentContentRect];
progressBarFrame.origin.y = NSMinY(messageFrame) -
- kProgressBarTopPadding - kProgressBarThickness;
- progressBarFrame.size.height = kProgressBarThickness;
+ message_center::kProgressBarTopPadding -
+ message_center::kProgressBarThickness;
+ progressBarFrame.size.height = message_center::kProgressBarThickness;
progressBarView_.reset(
[[MCNotificationProgressBar alloc] initWithFrame:progressBarFrame]);
// Setting indeterminate to NO does not work with custom drawRect.
diff --git a/ui/message_center/cocoa/tray_view_controller.mm b/ui/message_center/cocoa/tray_view_controller.mm
index 26c9b73ad9..45cb1a4c98 100644
--- a/ui/message_center/cocoa/tray_view_controller.mm
+++ b/ui/message_center/cocoa/tray_view_controller.mm
@@ -163,13 +163,6 @@ const CGFloat kTrayBottomMargin = 75;
if (settingsController_)
return [self updateTrayViewAndWindow];
- // When the window is visible, the only update is to remove notifications
- // dismissed by the user.
- if ([[[self view] window] isVisible]) {
- [self closeNotificationsByUser];
- return;
- }
-
std::map<std::string, MCNotificationController*> newMap;
base::scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]);
diff --git a/ui/message_center/message_center_style.h b/ui/message_center/message_center_style.h
index 8d04fc88a2..222a61df61 100644
--- a/ui/message_center/message_center_style.h
+++ b/ui/message_center/message_center_style.h
@@ -78,6 +78,13 @@ const SkColor kButtonSeparatorColor = SkColorSetRGB(234, 234, 234);
const SkColor kHoveredButtonBackgroundColor = SkColorSetRGB(243, 243, 243);
#endif
+// Progress bar.
+const int kProgressBarThickness = 5;
+const int kProgressBarTopPadding = 16;
+const int kProgressBarCornerRadius = 3;
+const SkColor kProgressBarBackgroundColor = SkColorSetRGB(216, 216, 216);
+const SkColor kProgressBarSliceColor = SkColorSetRGB(120, 120, 120);
+
// Line limits.
const int kTitleLineLimit = 3;
const int kMessageCollapsedLineLimit = 3;
diff --git a/ui/message_center/message_center_tray_delegate.h b/ui/message_center/message_center_tray_delegate.h
index 85b24696e7..bd5c8855d8 100644
--- a/ui/message_center/message_center_tray_delegate.h
+++ b/ui/message_center/message_center_tray_delegate.h
@@ -9,6 +9,8 @@
namespace message_center {
+class MessageCenterTray;
+
// A MessageCenterTrayDelegate class is responsible for managing the various UI
// surfaces that should be displayed when the MessageCenter is changed.
class MESSAGE_CENTER_EXPORT MessageCenterTrayDelegate {
@@ -37,7 +39,9 @@ class MESSAGE_CENTER_EXPORT MessageCenterTrayDelegate {
// Show a platform-specific UI that informs the user how to open the message
// center.
- virtual void DisplayFirstRunBalloon() {};
+ virtual void DisplayFirstRunBalloon() {}
+
+ virtual MessageCenterTray* GetMessageCenterTray() = 0;
};
} // namespace message_center
diff --git a/ui/message_center/message_center_tray_unittest.cc b/ui/message_center/message_center_tray_unittest.cc
index bf2005b254..108cee7aa2 100644
--- a/ui/message_center/message_center_tray_unittest.cc
+++ b/ui/message_center/message_center_tray_unittest.cc
@@ -31,6 +31,10 @@ class MockDelegate : public MessageCenterTrayDelegate {
return false;
}
+ virtual MessageCenterTray* GetMessageCenterTray() OVERRIDE {
+ return NULL;
+ }
+
bool show_popups_success_;
bool show_message_center_success_;
diff --git a/ui/message_center/views/message_center_bubble.cc b/ui/message_center/views/message_center_bubble.cc
index be3c296e86..aa8b6469b2 100644
--- a/ui/message_center/views/message_center_bubble.cc
+++ b/ui/message_center/views/message_center_bubble.cc
@@ -91,6 +91,7 @@ views::TrayBubbleView::InitParams MessageCenterBubble::GetInitParams(
void MessageCenterBubble::InitializeContents(
views::TrayBubbleView* new_bubble_view) {
set_bubble_view(new_bubble_view);
+ bubble_view()->GetWidget()->AddObserver(this);
message_center_view_ = new MessageCenterView(
message_center(),
tray(),
@@ -120,6 +121,12 @@ void MessageCenterBubble::UpdateBubbleView() {
bubble_view()->UpdateBubble();
}
+void MessageCenterBubble::OnWidgetClosing(views::Widget* widget) {
+ bubble_view()->GetWidget()->RemoveObserver(this);
+ if (message_center_view_)
+ message_center_view_->SetIsClosing(true);
+}
+
void MessageCenterBubble::OnMouseEnteredView() {
}
diff --git a/ui/message_center/views/message_center_bubble.h b/ui/message_center/views/message_center_bubble.h
index f68449f69e..521bf4ac8e 100644
--- a/ui/message_center/views/message_center_bubble.h
+++ b/ui/message_center/views/message_center_bubble.h
@@ -8,6 +8,7 @@
#include "base/memory/weak_ptr.h"
#include "ui/message_center/message_center_export.h"
#include "ui/message_center/views/message_bubble_base.h"
+#include "ui/views/widget/widget_observer.h"
namespace message_center {
@@ -16,6 +17,7 @@ class MessageCenterView;
// Bubble for message center.
class MESSAGE_CENTER_EXPORT MessageCenterBubble
: public MessageBubbleBase,
+ public views::WidgetObserver,
public base::SupportsWeakPtr<MessageCenterBubble> {
public:
MessageCenterBubble(MessageCenter* message_center,
@@ -26,6 +28,9 @@ class MESSAGE_CENTER_EXPORT MessageCenterBubble
void SetSettingsVisible();
+ // Overridden from views::WidgetObserver:
+ virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+
// Overridden from MessageBubbleBase:
virtual views::TrayBubbleView::InitParams GetInitParams(
views::TrayBubbleView::AnchorAlignment anchor_alignment) OVERRIDE;
diff --git a/ui/message_center/views/message_center_view.cc b/ui/message_center/views/message_center_view.cc
index 0792ec8a69..ee7ac74f4a 100644
--- a/ui/message_center/views/message_center_view.cc
+++ b/ui/message_center/views/message_center_view.cc
@@ -805,7 +805,8 @@ MessageCenterView::MessageCenterView(MessageCenter* message_center,
: message_center_(message_center),
tray_(tray),
top_down_(top_down),
- settings_visible_(initially_settings_visible) {
+ settings_visible_(initially_settings_visible),
+ is_closing_(false) {
message_center_->AddObserver(this);
set_notify_enter_exit_on_child(true);
set_background(views::Background::CreateSolidBackground(
@@ -845,11 +846,15 @@ MessageCenterView::MessageCenterView(MessageCenter* message_center,
}
MessageCenterView::~MessageCenterView() {
- message_center_->RemoveObserver(this);
+ if (!is_closing_)
+ message_center_->RemoveObserver(this);
}
void MessageCenterView::SetNotifications(
const NotificationList::Notifications& notifications) {
+ if (is_closing_)
+ return;
+
message_views_.clear();
int index = 0;
for (NotificationList::Notifications::const_iterator iter =
@@ -864,6 +869,9 @@ void MessageCenterView::SetNotifications(
}
void MessageCenterView::SetSettingsVisible(bool visible) {
+ if (is_closing_)
+ return;
+
if (visible == settings_visible_)
return;
@@ -907,7 +915,18 @@ void MessageCenterView::SetSettingsVisible(bool visible) {
settings_transition_animation_->Start();
}
+void MessageCenterView::SetIsClosing(bool is_closing) {
+ is_closing_ = is_closing;
+ if (is_closing)
+ message_center_->RemoveObserver(this);
+ else
+ message_center_->AddObserver(this);
+}
+
void MessageCenterView::ClearAllNotifications() {
+ if (is_closing_)
+ return;
+
scroller_->SetEnabled(false);
button_bar_->SetAllButtonsEnabled(false);
message_list_view_->ClearAllNotifications(scroller_->GetVisibleRect());
@@ -924,6 +943,9 @@ size_t MessageCenterView::NumMessageViewsForTest() const {
}
void MessageCenterView::Layout() {
+ if (is_closing_)
+ return;
+
int button_height = button_bar_->GetHeightForWidth(width());
// Skip unnecessary re-layout of contents during the resize animation.
if (settings_transition_animation_ &&
@@ -1022,6 +1044,9 @@ bool MessageCenterView::OnMouseWheel(const ui::MouseWheelEvent& event) {
}
void MessageCenterView::OnMouseExited(const ui::MouseEvent& event) {
+ if (is_closing_)
+ return;
+
message_list_view_->ResetRepositionSession();
NotificationsChanged();
}
diff --git a/ui/message_center/views/message_center_view.h b/ui/message_center/views/message_center_view.h
index 2b9691ca6e..506a3a4533 100644
--- a/ui/message_center/views/message_center_view.h
+++ b/ui/message_center/views/message_center_view.h
@@ -56,6 +56,8 @@ class MESSAGE_CENTER_EXPORT MessageCenterView : public views::View,
void SetSettingsVisible(bool visible);
bool settings_visible() const { return settings_visible_; }
+ void SetIsClosing(bool is_closing);
+
protected:
// Overridden from views::View:
virtual void Layout() OVERRIDE;
@@ -100,6 +102,10 @@ class MESSAGE_CENTER_EXPORT MessageCenterView : public views::View,
int target_height_;
scoped_ptr<ui::MultiAnimation> settings_transition_animation_;
+ // True when the widget is closing so that further operations should be
+ // ignored.
+ bool is_closing_;
+
DISALLOW_COPY_AND_ASSIGN(MessageCenterView);
};
diff --git a/ui/message_center/views/message_popup_collection.cc b/ui/message_center/views/message_popup_collection.cc
index f147ec098d..f08c986894 100644
--- a/ui/message_center/views/message_popup_collection.cc
+++ b/ui/message_center/views/message_popup_collection.cc
@@ -315,25 +315,25 @@ int MessagePopupCollection::GetBaseLine(ToastContentsView* last_toast) {
int base;
if (top_down) {
- if (!last_toast)
+ if (!last_toast) {
base = work_area_.y();
- else
- base = toasts_.back()->bounds().bottom();
-
- if (!first_item_has_no_margin_)
- base += kToastMarginY;
- else
- base -= kNoToastMarginBorderAndShadowOffset;
+ if (!first_item_has_no_margin_)
+ base += kToastMarginY;
+ else
+ base -= kNoToastMarginBorderAndShadowOffset;
+ } else {
+ base = toasts_.back()->bounds().bottom() + kToastMarginY;
+ }
} else {
- if (!last_toast)
+ if (!last_toast) {
base = work_area_.bottom();
- else
- base = toasts_.back()->origin().y();
-
- if (!first_item_has_no_margin_)
- base -= kToastMarginY;
- else
- base += kNoToastMarginBorderAndShadowOffset;
+ if (!first_item_has_no_margin_)
+ base -= kToastMarginY;
+ else
+ base += kNoToastMarginBorderAndShadowOffset;
+ } else {
+ base = toasts_.back()->origin().y() - kToastMarginY;
+ }
}
return base;
}
diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc
index 7947f47eb3..e829bee1ea 100644
--- a/ui/message_center/views/notification_view.cc
+++ b/ui/message_center/views/notification_view.cc
@@ -13,6 +13,7 @@
#include "ui/base/text/text_elider.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/size.h"
+#include "ui/gfx/skia_util.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_style.h"
#include "ui/message_center/message_center_switches.h"
@@ -41,9 +42,7 @@ const int kTextRightPadding = 23;
const int kItemTitleToMessagePadding = 3;
const int kProgressBarWidth = message_center::kNotificationWidth -
kTextLeftPadding - kTextRightPadding;
-const int kProgressBarHeight = 8;
-const int kProgressBarTopPadding = 12;
-const int kProgressBarBottomPadding = 2;
+const int kProgressBarBottomPadding = 0;
const int kButtonVecticalPadding = 0;
const int kButtonTitleTopPadding = 0;
@@ -244,6 +243,7 @@ class NotificationProgressBar : public views::ProgressBar {
private:
// Overriden from View
virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(NotificationProgressBar);
};
@@ -255,12 +255,45 @@ NotificationProgressBar::~NotificationProgressBar() {
}
gfx::Size NotificationProgressBar::GetPreferredSize() {
- gfx::Size pref_size(kProgressBarWidth, kProgressBarHeight);
+ gfx::Size pref_size(kProgressBarWidth, message_center::kProgressBarThickness);
gfx::Insets insets = GetInsets();
pref_size.Enlarge(insets.width(), insets.height());
return pref_size;
}
+void NotificationProgressBar::OnPaint(gfx::Canvas* canvas) {
+ gfx::Rect content_bounds = GetContentsBounds();
+
+ // Draw background.
+ SkPath background_path;
+ background_path.addRoundRect(gfx::RectToSkRect(content_bounds),
+ message_center::kProgressBarCornerRadius,
+ message_center::kProgressBarCornerRadius);
+ SkPaint background_paint;
+ background_paint.setStyle(SkPaint::kFill_Style);
+ background_paint.setFlags(SkPaint::kAntiAlias_Flag);
+ background_paint.setColor(message_center::kProgressBarBackgroundColor);
+ canvas->DrawPath(background_path, background_paint);
+
+ // Draw slice.
+ const int slice_width =
+ static_cast<int>(content_bounds.width() * GetNormalizedValue() + 0.5);
+ if (slice_width < 1)
+ return;
+
+ gfx::Rect slice_bounds = content_bounds;
+ slice_bounds.set_width(slice_width);
+ SkPath slice_path;
+ slice_path.addRoundRect(gfx::RectToSkRect(slice_bounds),
+ message_center::kProgressBarCornerRadius,
+ message_center::kProgressBarCornerRadius);
+ SkPaint slice_paint;
+ slice_paint.setStyle(SkPaint::kFill_Style);
+ slice_paint.setFlags(SkPaint::kAntiAlias_Flag);
+ slice_paint.setColor(message_center::kProgressBarSliceColor);
+ canvas->DrawPath(slice_path, slice_paint);
+}
+
// NotificationButton //////////////////////////////////////////////////////////
// NotificationButtons render the action buttons of notifications.
@@ -466,7 +499,7 @@ NotificationView::NotificationView(const Notification& notification,
if (notification.type() == NOTIFICATION_TYPE_PROGRESS) {
progress_bar_view_ = new NotificationProgressBar();
progress_bar_view_->set_border(MakeProgressBarBorder(
- kProgressBarTopPadding, kProgressBarBottomPadding));
+ message_center::kProgressBarTopPadding, kProgressBarBottomPadding));
progress_bar_view_->SetValue(notification.progress() / 100.0);
top_view_->AddChildView(progress_bar_view_);
}
diff --git a/ui/ui_unittests.gypi b/ui/ui_unittests.gypi
index f76871b90e..d5db0d5df6 100644
--- a/ui/ui_unittests.gypi
+++ b/ui/ui_unittests.gypi
@@ -155,6 +155,7 @@
'base/gtk/gtk_expanded_container_unittest.cc',
'base/gtk/gtk_im_context_util_unittest.cc',
'base/keycodes/usb_keycode_map_unittest.cc',
+ 'base/latency_info_unittest.cc',
'base/models/list_model_unittest.cc',
'base/models/list_selection_model_unittest.cc',
'base/models/tree_node_model_unittest.cc',
@@ -296,6 +297,11 @@
'base/view_prop_unittest.cc',
],
}],
+ ['use_x11==1 and use_aura==1', {
+ 'sources': [
+ 'base/cursor/cursor_loader_x11_unittest.cc',
+ ],
+ }],
['use_aura==1 or toolkit_views==1', {
'sources': [
'base/dragdrop/os_exchange_data_unittest.cc',
diff --git a/ui/views/ime/input_method_bridge.cc b/ui/views/ime/input_method_bridge.cc
index 3d9a458718..34f6e1b469 100644
--- a/ui/views/ime/input_method_bridge.cc
+++ b/ui/views/ime/input_method_bridge.cc
@@ -45,7 +45,10 @@ void InputMethodBridge::OnFocus() {
}
void InputMethodBridge::OnBlur() {
- ConfirmCompositionText();
+ if (HasCompositionText()) {
+ ConfirmCompositionText();
+ host_->CancelComposition(this);
+ }
if (host_->GetTextInputClient() == this)
host_->SetFocusedTextInputClient(NULL);
diff --git a/ui/views/widget/desktop_aura/OWNERS b/ui/views/widget/desktop_aura/OWNERS
new file mode 100644
index 0000000000..89630b157d
--- /dev/null
+++ b/ui/views/widget/desktop_aura/OWNERS
@@ -0,0 +1,5 @@
+# Elliot is the owner of all the X11 stuff.
+per-file *x11.cc=erg@chromium.org
+per-file *x11.h=erg@chromium.org
+per-file x11*=erg@chromium.org
+per-file x11*=erg@chromium.org
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 0b357f80d6..e97c950261 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -348,12 +348,14 @@ void Widget::Init(const InitParams& in_params) {
non_client_view_->set_client_view(widget_delegate_->CreateClientView(this));
non_client_view_->SetOverlayView(widget_delegate_->CreateOverlayView());
SetContentsView(non_client_view_);
+ // Initialize the window's title before setting the window's initial bounds;
+ // the frame view's preferred height may depend on the presence of a title.
+ UpdateWindowTitle();
SetInitialBounds(params.bounds);
if (params.show_state == ui::SHOW_STATE_MAXIMIZED)
Maximize();
else if (params.show_state == ui::SHOW_STATE_MINIMIZED)
Minimize();
- UpdateWindowTitle();
} else if (params.delegate) {
SetContentsView(params.delegate->GetContentsView());
SetInitialBoundsForFramelessWindow(params.bounds);
diff --git a/ui/views/window/dialog_delegate_unittest.cc b/ui/views/window/dialog_delegate_unittest.cc
index d7471e7972..ba891f4305 100644
--- a/ui/views/window/dialog_delegate_unittest.cc
+++ b/ui/views/window/dialog_delegate_unittest.cc
@@ -37,8 +37,9 @@ class TestDialog : public DialogDelegateView, public ButtonListener {
return closeable_;
}
- // View override:
+ // DialogDelegateView overrides:
virtual gfx::Size GetPreferredSize() OVERRIDE { return gfx::Size(200, 200); }
+ virtual string16 GetWindowTitle() const OVERRIDE { return title_; }
// ButtonListener override:
virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE {
@@ -73,12 +74,15 @@ class TestDialog : public DialogDelegateView, public ButtonListener {
GetWidget()->Close();
}
+ void set_title(const string16& title) { title_ = title; }
+
private:
bool canceled_;
bool accepted_;
// Prevent the dialog from closing, for repeated ok and cancel button clicks.
bool closeable_;
Button* last_pressed_button_;
+ string16 title_;
DISALLOW_COPY_AND_ASSIGN(TestDialog);
};
@@ -200,31 +204,51 @@ TEST_F(DialogTest, RemoveDefaultButton) {
}
TEST_F(DialogTest, HitTest) {
- const NonClientView* view = dialog()->GetWidget()->non_client_view();
+ if (!DialogDelegate::UseNewStyle())
+ return;
- if (DialogDelegate::UseNewStyle()) {
- // Ensure that the new style's BubbleFrameView hit-tests as expected.
- BubbleFrameView* frame = static_cast<BubbleFrameView*>(view->frame_view());
- const int border = frame->bubble_border()->GetBorderThickness();
-
- struct {
- const int point;
- const int hit;
- } cases[] = {
- { border, HTSYSMENU },
- { border + 10, HTSYSMENU },
- { border + 20, HTCAPTION },
- { border + 40, HTCLIENT },
- { border + 50, HTCLIENT },
- { 1000, HTNOWHERE },
- };
-
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
- gfx::Point point(cases[i].point, cases[i].point);
- EXPECT_EQ(cases[i].hit, frame->NonClientHitTest(point))
- << " with border: " << border << ", at point " << cases[i].point;
- }
+ // Ensure that the new style's BubbleFrameView hit-tests as expected.
+ const NonClientView* view = dialog()->GetWidget()->non_client_view();
+ BubbleFrameView* frame = static_cast<BubbleFrameView*>(view->frame_view());
+ const int border = frame->bubble_border()->GetBorderThickness();
+
+ struct {
+ const int point;
+ const int hit;
+ } cases[] = {
+ { border, HTSYSMENU },
+ { border + 10, HTSYSMENU },
+ { border + 20, HTCAPTION },
+ { border + 40, HTCLIENT },
+ { border + 50, HTCLIENT },
+ { 1000, HTNOWHERE },
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ gfx::Point point(cases[i].point, cases[i].point);
+ EXPECT_EQ(cases[i].hit, frame->NonClientHitTest(point))
+ << " with border: " << border << ", at point " << cases[i].point;
}
}
+TEST_F(DialogTest, InitialBoundsAccommodateTitle) {
+ if (!DialogDelegate::UseNewStyle())
+ return;
+
+ TestDialog* titled_dialog(new TestDialog());
+ titled_dialog->set_title(ASCIIToUTF16("Title"));
+ DialogDelegate::CreateDialogWidget(titled_dialog, GetContext(), NULL);
+
+ // Titled dialogs have taller initial frame bounds than untitled dialogs.
+ EXPECT_GT(titled_dialog->GetWidget()->GetWindowBoundsInScreen().height(),
+ dialog()->GetWidget()->GetWindowBoundsInScreen().height());
+
+ // Giving the default test dialog a title will make the bounds the same.
+ dialog()->set_title(ASCIIToUTF16("Title"));
+ dialog()->GetWidget()->UpdateWindowTitle();
+ View* frame = dialog()->GetWidget()->non_client_view()->frame_view();
+ EXPECT_EQ(titled_dialog->GetWidget()->GetWindowBoundsInScreen().height(),
+ frame->GetPreferredSize().height());
+}
+
} // namespace views
diff --git a/ui/webui/resources/js/cr/ui/overlay.js b/ui/webui/resources/js/cr/ui/overlay.js
index 293ca20f2c..5c0acb2d3d 100644
--- a/ui/webui/resources/js/cr/ui/overlay.js
+++ b/ui/webui/resources/js/cr/ui/overlay.js
@@ -58,8 +58,13 @@ cr.define('cr.ui.overlay', function() {
if (e.keyIdentifier == 'Enter' &&
!forbiddenTagNames.test(document.activeElement.tagName)) {
var button = getDefaultButton(overlay);
- if (button)
+ if (button) {
button.click();
+ // Executing the default button may result in focus moving to a
+ // different button. Calling preventDefault is necessary to not have
+ // that button execute as well.
+ e.preventDefault();
+ }
}
});