summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-27 01:00:27 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-27 01:00:27 +0000
commitd851106a4c47f58ff714c4f4e2d05b41490947ac (patch)
tree34166dbdd4d219dfe32c591a973d87fd25fa7fc2 /chrome
parent596650852ec1016cf7c5af66ed4236c9cb546c05 (diff)
downloadchromium_src-d851106a4c47f58ff714c4f4e2d05b41490947ac.zip
chromium_src-d851106a4c47f58ff714c4f4e2d05b41490947ac.tar.gz
chromium_src-d851106a4c47f58ff714c4f4e2d05b41490947ac.tar.bz2
Make the resize gripper invisible.
BUG=50107 TEST=Resize gripper nest to browser actions container should no longer appear Review URL: http://codereview.chromium.org/3052011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/browser_actions_toolbar_gtk.cc28
-rw-r--r--chrome/browser/gtk/browser_actions_toolbar_gtk.h4
-rw-r--r--chrome/browser/views/browser_actions_container.cc36
-rw-r--r--chrome/browser/views/browser_actions_container.h33
-rw-r--r--chrome/browser/views/extensions/extension_installed_bubble.cc1
5 files changed, 30 insertions, 72 deletions
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
index b60489a..2a864c5 100644
--- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
@@ -350,7 +350,6 @@ BrowserActionsToolbarGtk::BrowserActionsToolbarGtk(Browser* browser)
resize_animation_(this),
desired_width_(0),
start_width_(0),
- draw_gripper_(false),
method_factory_(this) {
ExtensionsService* extension_service = profile_->GetExtensionsService();
// The |extension_service| can be NULL in Incognito.
@@ -754,21 +753,6 @@ gboolean BrowserActionsToolbarGtk::OnGripperMotionNotify(
gboolean BrowserActionsToolbarGtk::OnGripperExpose(GtkWidget* gripper,
GdkEventExpose* expose) {
- if (!draw_gripper_)
- return TRUE;
-
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(expose->window));
-
- CairoCachedSurface* surface = theme_provider_->GetSurfaceNamed(
- IDR_RESIZE_GRIPPER, gripper);
- gfx::Point center = gfx::Rect(gripper->allocation).CenterPoint();
- center.Offset(-surface->Width() / 2, -surface->Height() / 2);
- surface->SetSource(cr, center.x(), center.y());
- gdk_cairo_rectangle(cr, &expose->area);
- cairo_fill(cr);
-
- cairo_destroy(cr);
-
return TRUE;
}
@@ -781,18 +765,13 @@ gboolean BrowserActionsToolbarGtk::OnGripperEnterNotify(
GtkWidget* gripper, GdkEventCrossing* event) {
gdk_window_set_cursor(gripper->window,
gtk_util::GetCursor(GDK_SB_H_DOUBLE_ARROW));
- draw_gripper_ = true;
-
return FALSE;
}
gboolean BrowserActionsToolbarGtk::OnGripperLeaveNotify(
GtkWidget* gripper, GdkEventCrossing* event) {
- if (!(event->state & GDK_BUTTON1_MASK)) {
+ if (!(event->state & GDK_BUTTON1_MASK))
gdk_window_set_cursor(gripper->window, NULL);
- draw_gripper_ = false;
- }
-
return FALSE;
}
@@ -801,11 +780,8 @@ gboolean BrowserActionsToolbarGtk::OnGripperButtonRelease(
gfx::Rect gripper_rect(0, 0,
gripper->allocation.width, gripper->allocation.height);
gfx::Point release_point(event->x, event->y);
- if (!gripper_rect.Contains(release_point)) {
+ if (!gripper_rect.Contains(release_point))
gdk_window_set_cursor(gripper->window, NULL);
- draw_gripper_ = false;
- gtk_widget_queue_draw(gripper);
- }
// After the user resizes the toolbar, we want to smartly resize it to be
// the perfect size to fit the buttons.
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.h b/chrome/browser/gtk/browser_actions_toolbar_gtk.h
index 441753a..6e472c5 100644
--- a/chrome/browser/gtk/browser_actions_toolbar_gtk.h
+++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.h
@@ -196,10 +196,6 @@ class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer,
// This is the width we were at when we started animating.
int start_width_;
- // We only draw the browser action gripper when the user is hovering over it
- // or dragging it.
- bool draw_gripper_;
-
GtkSignalRegistrar signals_;
ScopedRunnableMethodFactory<BrowserActionsToolbarGtk> method_factory_;
diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc
index d5a8fde..06afa92 100644
--- a/chrome/browser/views/browser_actions_container.cc
+++ b/chrome/browser/views/browser_actions_container.cc
@@ -75,8 +75,8 @@ static const int kChevronTopMargin = 9;
// The margin to the right of the chevron.
static const int kChevronRightMargin = 4;
-// Extra hit-area for the resize gripper.
-static const int kExtraResizeArea = 4;
+// Width for the resize area.
+static const int kResizeAreaWidth = 4;
// Width of the drop indicator.
static const int kDropIndicatorWidth = 2;
@@ -367,7 +367,6 @@ BrowserActionsContainer::BrowserActionsContainer(
popup_(NULL),
popup_button_(NULL),
model_(NULL),
- resize_gripper_(NULL),
chevron_(NULL),
overflow_menu_(NULL),
suppress_chevron_(false),
@@ -383,11 +382,9 @@ BrowserActionsContainer::BrowserActionsContainer(
model_->AddObserver(this);
}
resize_animation_.reset(new SlideAnimation(this));
- resize_gripper_ = new views::ResizeGripper(this);
- resize_gripper_->SetAccessibleName(
- l10n_util::GetString(IDS_ACCNAME_SEPARATOR));
- resize_gripper_->SetVisible(false);
- AddChildView(resize_gripper_);
+ resize_area_ = new views::ResizeArea(this);
+ resize_area_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_SEPARATOR));
+ AddChildView(resize_area_);
// TODO(glen): Come up with a new bitmap for the chevron.
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
@@ -520,8 +517,6 @@ void BrowserActionsContainer::DeleteBrowserActionViews() {
void BrowserActionsContainer::OnBrowserActionVisibilityChanged() {
SetVisible(browser_action_views_.size() > 0);
- resize_gripper_->SetVisible(browser_action_views_.size() > 0);
-
owner_view_->Layout();
owner_view_->SchedulePaint();
}
@@ -613,23 +608,14 @@ gfx::Size BrowserActionsContainer::GetPreferredSize() {
void BrowserActionsContainer::Layout() {
if (browser_action_views_.size() == 0) {
SetVisible(false);
- resize_gripper_->SetVisible(false);
chevron_->SetVisible(false);
return;
} else {
SetVisible(true);
- resize_gripper_->SetVisible(true);
}
- int x = 0;
- if (resize_gripper_->IsVisible()) {
- // We'll draw the resize gripper a little wider, to add some invisible hit
- // target area - but we don't account for it anywhere.
- gfx::Size sz = resize_gripper_->GetPreferredSize();
- resize_gripper_->SetBounds(x, (height() - sz.height()) / 2 + 1,
- sz.width() + kExtraResizeArea, sz.height());
- x += sz.width();
- }
+ resize_area_->SetBounds(0, 0, kResizeAreaWidth, height());
+ int x = kResizeAreaWidth;
x += base::i18n::IsRTL() ? kHorizontalPaddingRtl : kHorizontalPadding;
@@ -898,7 +884,7 @@ int BrowserActionsContainer::ClampToNearestIconCount(
size_t icon_count = 0u;
if (pixelWidth >= 0) {
// Caller wants to know how many icons fit within a given space so we start
- // by subtracting the padding, gripper and dividers.
+ // by subtracting the padding, resize area and dividers.
int icon_area = pixelWidth - extras;
icon_area = std::max(0, icon_area);
@@ -1047,8 +1033,8 @@ int BrowserActionsContainer::WidthOfNonIconArea() const {
chevron_->GetPreferredSize().width() : 0;
int padding = base::i18n::IsRTL() ?
kHorizontalPaddingRtl : kHorizontalPadding;
- return resize_gripper_->GetPreferredSize().width() + padding +
- chevron_size + kChevronRightMargin + kDividerHorizontalMargin;
+ return kResizeAreaWidth + padding + chevron_size + kChevronRightMargin +
+ kDividerHorizontalMargin;
}
int BrowserActionsContainer::IconCountToWidth(int icons) const {
@@ -1062,7 +1048,7 @@ int BrowserActionsContainer::IconCountToWidth(int icons) const {
}
int BrowserActionsContainer::ContainerMinSize() const {
- return resize_gripper_->width() + chevron_->width() + kChevronRightMargin;
+ return kResizeAreaWidth + chevron_->width() + kChevronRightMargin;
}
void BrowserActionsContainer::Animate(Tween::Type tween_type, int target_size) {
diff --git a/chrome/browser/views/browser_actions_container.h b/chrome/browser/views/browser_actions_container.h
index 4dd4761..7c13eed 100644
--- a/chrome/browser/views/browser_actions_container.h
+++ b/chrome/browser/views/browser_actions_container.h
@@ -22,7 +22,7 @@
#include "chrome/common/notification_registrar.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/view_menu_delegate.h"
-#include "views/controls/resize_gripper.h"
+#include "views/controls/resize_area.h"
#include "views/view.h"
class Browser;
@@ -183,11 +183,11 @@ class BrowserActionView : public views::View {
// The BrowserActionsContainer (when it contains one or more icons) consists of
// the following elements, numbered as seen below the line:
//
-// || _ Icon _ Icon _ Icon _ [chevron] _ | _
+// r _ Icon _ Icon _ Icon _ [chevron] _ | _
// -----------------------------------------
-// 1 2 3 4 5 6 7 8
+// 1 2 3 4 5 6 7 8
//
-// 1) The ResizeGripper view.
+// 1) An invisible resize area.
// 2) Padding (kHorizontalPadding).
// 3) The browser action icon button (BrowserActionView).
// 4) Padding to visually separate icons from one another
@@ -204,8 +204,8 @@ class BrowserActionView : public views::View {
// 1) The container can never grow beyond the space needed to show all icons
// (hereby referred to as the max width).
// 2) The container can never shrink below the space needed to show just the
-// resize gripper and the chevron (ignoring the case where there are no icons to
-// show, in which case the container won't be visible anyway).
+// initial padding and the chevron (ignoring the case where there are no icons
+// to show, in which case the container won't be visible anyway).
// 3) The container snaps into place (to the pixel count that fits the visible
// icons) to make sure there is no wasted space at the edges of the container.
// 4) If the user adds or removes icons (read: installs/uninstalls browser
@@ -219,12 +219,11 @@ class BrowserActionView : public views::View {
//
// Resizing the BrowserActionsContainer:
//
-// The ResizeGripper view sends OnResize messages to the BrowserActionsContainer
-// class as the user drags the gripper. This modifies the value for
-// |resize_amount_|. That indicates to the container that a resize is in
-// progress and is used to calculate the size in GetPreferredSize(), though
-// that function never exceeds the defined minimum and maximum size of the
-// container.
+// The ResizeArea view sends OnResize messages to the BrowserActionsContainer
+// class as the user drags it. This modifies the value for |resize_amount_|.
+// That indicates to the container that a resize is in progress and is used to
+// calculate the size in GetPreferredSize(), though that function never exceeds
+// the defined minimum and maximum size of the container.
//
// When the user releases the mouse (ends the resize), we calculate a target
// size for the container (animation_target_size_), clamp that value to the
@@ -252,7 +251,7 @@ class BrowserActionsContainer
: public views::View,
public views::ViewMenuDelegate,
public views::DragController,
- public views::ResizeGripper::ResizeGripperDelegate,
+ public views::ResizeArea::ResizeAreaDelegate,
public AnimationDelegate,
public ExtensionToolbarModel::Observer,
public BrowserActionOverflowMenuController::Observer,
@@ -338,7 +337,7 @@ class BrowserActionsContainer
const gfx::Point& press_pt,
const gfx::Point& p);
- // Overridden from ResizeGripper::ResizeGripperDelegate:
+ // Overridden from ResizeArea::ResizeAreaDelegate:
virtual void OnResize(int resize_amount, bool done_resizing);
// Overridden from AnimationDelegate:
@@ -421,7 +420,7 @@ class BrowserActionsContainer
int WidthOfNonIconArea() const;
// Given a number of |icons| return the amount of pixels needed to draw it,
- // including the controls (chevron if visible and resize gripper).
+ // including the controls (chevron if visible and resize area).
int IconCountToWidth(int icons) const;
// Returns the absolute minimum size you can shrink the container down to and
@@ -464,8 +463,8 @@ class BrowserActionsContainer
// The current size of the container.
gfx::Size container_size_;
- // The resize gripper for the container.
- views::ResizeGripper* resize_gripper_;
+ // The resize area for the container.
+ views::ResizeArea* resize_area_;
// The chevron for accessing the overflow items.
views::MenuButton* chevron_;
diff --git a/chrome/browser/views/extensions/extension_installed_bubble.cc b/chrome/browser/views/extensions/extension_installed_bubble.cc
index 1799ee4..2697ef9 100644
--- a/chrome/browser/views/extensions/extension_installed_bubble.cc
+++ b/chrome/browser/views/extensions/extension_installed_bubble.cc
@@ -26,6 +26,7 @@
#include "grit/theme_resources.h"
#include "views/controls/button/checkbox.h"
#include "views/controls/button/image_button.h"
+#include "views/controls/image_view.h"
#include "views/controls/label.h"
#include "views/standard_layout.h"
#include "views/view.h"