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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc

Issue 2251263003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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/bookmarks/bookmark_bar_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return border; 235 return border;
236 } 236 }
237 237
238 bool IsTriggerableEvent(const ui::Event& e) override { 238 bool IsTriggerableEvent(const ui::Event& e) override {
239 return e.type() == ui::ET_GESTURE_TAP || 239 return e.type() == ui::ET_GESTURE_TAP ||
240 e.type() == ui::ET_GESTURE_TAP_DOWN || 240 e.type() == ui::ET_GESTURE_TAP_DOWN ||
241 event_utils::IsPossibleDispositionEvent(e); 241 event_utils::IsPossibleDispositionEvent(e);
242 } 242 }
243 243
244 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { 244 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override {
245 return base::WrapUnique(new views::FloodFillInkDropRipple( 245 return base::MakeUnique<views::FloodFillInkDropRipple>(
246 CalculateInkDropBounds(size()), GetInkDropCenterBasedOnLastEvent(), 246 CalculateInkDropBounds(size()), GetInkDropCenterBasedOnLastEvent(),
247 GetInkDropBaseColor(), ink_drop_visible_opacity())); 247 GetInkDropBaseColor(), ink_drop_visible_opacity());
248 } 248 }
249 249
250 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() 250 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
251 const override { 251 const override {
252 if (!ShouldShowInkDropHighlight()) 252 if (!ShouldShowInkDropHighlight())
253 return nullptr; 253 return nullptr;
254 254
255 const gfx::Rect bounds = CalculateInkDropBounds(size()); 255 const gfx::Rect bounds = CalculateInkDropBounds(size());
256 return base::WrapUnique(new views::InkDropHighlight( 256 return base::MakeUnique<views::InkDropHighlight>(
257 bounds.size(), 0, gfx::RectF(bounds).CenterPoint(), 257 bounds.size(), 0, gfx::RectF(bounds).CenterPoint(),
258 GetInkDropBaseColor())); 258 GetInkDropBaseColor());
259 } 259 }
260 260
261 SkColor GetInkDropBaseColor() const override { 261 SkColor GetInkDropBaseColor() const override {
262 return GetThemeProvider()->GetColor( 262 return GetThemeProvider()->GetColor(
263 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); 263 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
264 } 264 }
265 265
266 private: 266 private:
267 std::unique_ptr<gfx::SlideAnimation> show_animation_; 267 std::unique_ptr<gfx::SlideAnimation> show_animation_;
268 268
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 views::MenuButtonListener* menu_button_listener, 336 views::MenuButtonListener* menu_button_listener,
337 bool show_menu_marker) 337 bool show_menu_marker)
338 : MenuButton(title, menu_button_listener, show_menu_marker) { 338 : MenuButton(title, menu_button_listener, show_menu_marker) {
339 if (ui::MaterialDesignController::IsModeMaterial()) { 339 if (ui::MaterialDesignController::IsModeMaterial()) {
340 SetInkDropMode(InkDropMode::ON); 340 SetInkDropMode(InkDropMode::ON);
341 SetFocusPainter(nullptr); 341 SetFocusPainter(nullptr);
342 } 342 }
343 } 343 }
344 344
345 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { 345 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override {
346 return base::WrapUnique(new views::FloodFillInkDropRipple( 346 return base::MakeUnique<views::FloodFillInkDropRipple>(
347 CalculateInkDropBounds(size()), GetInkDropCenterBasedOnLastEvent(), 347 CalculateInkDropBounds(size()), GetInkDropCenterBasedOnLastEvent(),
348 GetInkDropBaseColor(), ink_drop_visible_opacity())); 348 GetInkDropBaseColor(), ink_drop_visible_opacity());
349 } 349 }
350 350
351 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() 351 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
352 const override { 352 const override {
353 if (!ShouldShowInkDropHighlight()) 353 if (!ShouldShowInkDropHighlight())
354 return nullptr; 354 return nullptr;
355 355
356 const gfx::Rect bounds = CalculateInkDropBounds(size()); 356 const gfx::Rect bounds = CalculateInkDropBounds(size());
357 return base::WrapUnique(new views::InkDropHighlight( 357 return base::MakeUnique<views::InkDropHighlight>(
358 bounds.size(), 0, gfx::RectF(bounds).CenterPoint(), 358 bounds.size(), 0, gfx::RectF(bounds).CenterPoint(),
359 GetInkDropBaseColor())); 359 GetInkDropBaseColor());
360 } 360 }
361 361
362 SkColor GetInkDropBaseColor() const override { 362 SkColor GetInkDropBaseColor() const override {
363 return GetThemeProvider()->GetColor( 363 return GetThemeProvider()->GetColor(
364 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); 364 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
365 } 365 }
366 366
367 private: 367 private:
368 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuButtonBase); 368 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuButtonBase);
369 }; 369 };
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 return; 2174 return;
2175 apps_page_shortcut_->SetVisible(visible); 2175 apps_page_shortcut_->SetVisible(visible);
2176 UpdateBookmarksSeparatorVisibility(); 2176 UpdateBookmarksSeparatorVisibility();
2177 LayoutAndPaint(); 2177 LayoutAndPaint();
2178 } 2178 }
2179 2179
2180 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { 2180 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() {
2181 if (UpdateOtherAndManagedButtonsVisibility()) 2181 if (UpdateOtherAndManagedButtonsVisibility())
2182 LayoutAndPaint(); 2182 LayoutAndPaint();
2183 } 2183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698