Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: fix cros build Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/tabs/tab_strip.h" 5 #include "chrome/browser/ui/views/tabs/tab_strip.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 /////////////////////////////////////////////////////////////////////////////// 263 ///////////////////////////////////////////////////////////////////////////////
264 // NewTabButton 264 // NewTabButton
265 // 265 //
266 // A subclass of button that hit-tests to the shape of the new tab button and 266 // A subclass of button that hit-tests to the shape of the new tab button and
267 // does custom drawing. 267 // does custom drawing.
268 268
269 class NewTabButton : public views::ImageButton, 269 class NewTabButton : public views::ImageButton,
270 public views::MaskedTargeterDelegate { 270 public views::MaskedTargeterDelegate {
271 public: 271 public:
272 NewTabButton(TabStrip* tab_strip, views::ButtonListener* listener); 272 NewTabButton(TabStrip* tab_strip, views::ImageButtonDelegate* listener);
273 ~NewTabButton() override; 273 ~NewTabButton() override;
274 274
275 // Set the background offset used to match the background image to the frame 275 // Set the background offset used to match the background image to the frame
276 // image. 276 // image.
277 void set_background_offset(const gfx::Point& offset) { 277 void set_background_offset(const gfx::Point& offset) {
278 background_offset_ = offset; 278 background_offset_ = offset;
279 } 279 }
280 280
281 private: 281 private:
282 // views::ImageButton: 282 // views::ImageButton:
(...skipping 28 matching lines...) Expand all
311 311
312 // The offset used to paint the background image. 312 // The offset used to paint the background image.
313 gfx::Point background_offset_; 313 gfx::Point background_offset_;
314 314
315 // were we destroyed? 315 // were we destroyed?
316 bool* destroyed_; 316 bool* destroyed_;
317 317
318 DISALLOW_COPY_AND_ASSIGN(NewTabButton); 318 DISALLOW_COPY_AND_ASSIGN(NewTabButton);
319 }; 319 };
320 320
321 NewTabButton::NewTabButton(TabStrip* tab_strip, views::ButtonListener* listener) 321 NewTabButton::NewTabButton(TabStrip* tab_strip,
322 : views::ImageButton(listener), 322 views::ImageButtonDelegate* listener)
323 tab_strip_(tab_strip), 323 : views::ImageButton(listener), tab_strip_(tab_strip), destroyed_(NULL) {
324 destroyed_(NULL) {
325 set_animate_on_state_change(true); 324 set_animate_on_state_change(true);
326 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 325 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
327 set_triggerable_event_flags(triggerable_event_flags() | 326 set_triggerable_event_flags(triggerable_event_flags() |
328 ui::EF_MIDDLE_MOUSE_BUTTON); 327 ui::EF_MIDDLE_MOUSE_BUTTON);
329 #endif 328 #endif
330 } 329 }
331 330
332 NewTabButton::~NewTabButton() { 331 NewTabButton::~NewTabButton() {
333 if (destroyed_) 332 if (destroyed_)
334 *destroyed_ = true; 333 *destroyed_ = true;
(...skipping 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); 2780 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point);
2782 if (view) 2781 if (view)
2783 return view; 2782 return view;
2784 } 2783 }
2785 Tab* tab = FindTabForEvent(point); 2784 Tab* tab = FindTabForEvent(point);
2786 if (tab) 2785 if (tab)
2787 return ConvertPointToViewAndGetEventHandler(this, tab, point); 2786 return ConvertPointToViewAndGetEventHandler(this, tab, point);
2788 } 2787 }
2789 return this; 2788 return this;
2790 } 2789 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698