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

Side by Side Diff: chrome/browser/ui/views/website_settings/chooser_bubble_ui_view.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/website_settings/chooser_bubble_ui_view.h" 5 #include "chrome/browser/ui/views/website_settings/chooser_bubble_ui_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h"
14 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
18 #include "chrome/browser/ui/views/frame/browser_view.h" 19 #include "chrome/browser/ui/views/frame/browser_view.h"
19 #include "chrome/browser/ui/views/frame/top_container_view.h" 20 #include "chrome/browser/ui/views/frame/top_container_view.h"
20 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 21 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
21 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 22 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
22 #include "chrome/browser/ui/website_settings/chooser_bubble_controller.h" 23 #include "chrome/browser/ui/website_settings/chooser_bubble_controller.h"
23 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
(...skipping 21 matching lines...) Expand all
45 namespace { 46 namespace {
46 47
47 // Chooser permission bubble width 48 // Chooser permission bubble width
48 const int kChooserPermissionBubbleWidth = 300; 49 const int kChooserPermissionBubbleWidth = 300;
49 50
50 // Chooser permission bubble height 51 // Chooser permission bubble height
51 const int kChooserPermissionBubbleHeight = 200; 52 const int kChooserPermissionBubbleHeight = 200;
52 53
53 } // namespace 54 } // namespace
54 55
55 scoped_ptr<BubbleUi> ChooserBubbleController::BuildBubbleUi() { 56 std::unique_ptr<BubbleUi> ChooserBubbleController::BuildBubbleUi() {
56 return make_scoped_ptr(new ChooserBubbleUiView(browser_, this)); 57 return base::WrapUnique(new ChooserBubbleUiView(browser_, this));
57 } 58 }
58 59
59 class ChooserTableModel; 60 class ChooserTableModel;
60 61
61 /////////////////////////////////////////////////////////////////////////////// 62 ///////////////////////////////////////////////////////////////////////////////
62 // View implementation for the chooser bubble. 63 // View implementation for the chooser bubble.
63 class ChooserBubbleUiViewDelegate : public views::BubbleDelegateView, 64 class ChooserBubbleUiViewDelegate : public views::BubbleDelegateView,
64 public views::ButtonListener, 65 public views::ButtonListener,
65 public views::StyledLabelListener, 66 public views::StyledLabelListener,
66 public views::TableViewObserver { 67 public views::TableViewObserver {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 return; 302 return;
302 303
303 set_arrow(anchor_arrow); 304 set_arrow(anchor_arrow);
304 305
305 // Update the border in the bubble: will either add or remove the arrow. 306 // Update the border in the bubble: will either add or remove the arrow.
306 views::BubbleFrameView* frame = 307 views::BubbleFrameView* frame =
307 views::BubbleDelegateView::GetBubbleFrameView(); 308 views::BubbleDelegateView::GetBubbleFrameView();
308 views::BubbleBorder::Arrow adjusted_arrow = anchor_arrow; 309 views::BubbleBorder::Arrow adjusted_arrow = anchor_arrow;
309 if (base::i18n::IsRTL()) 310 if (base::i18n::IsRTL())
310 adjusted_arrow = views::BubbleBorder::horizontal_mirror(adjusted_arrow); 311 adjusted_arrow = views::BubbleBorder::horizontal_mirror(adjusted_arrow);
311 frame->SetBubbleBorder(scoped_ptr<views::BubbleBorder>( 312 frame->SetBubbleBorder(std::unique_ptr<views::BubbleBorder>(
312 new views::BubbleBorder(adjusted_arrow, shadow(), color()))); 313 new views::BubbleBorder(adjusted_arrow, shadow(), color())));
313 314
314 // Reposition the bubble based on the updated arrow and view. 315 // Reposition the bubble based on the updated arrow and view.
315 SetAnchorView(anchor_view); 316 SetAnchorView(anchor_view);
316 } 317 }
317 318
318 ChooserTableModel::ChooserTableModel(ChooserBubbleController* controller) 319 ChooserTableModel::ChooserTableModel(ChooserBubbleController* controller)
319 : observer_(nullptr), controller_(controller) { 320 : observer_(nullptr), controller_(controller) {
320 controller_->set_observer(this); 321 controller_->set_observer(this);
321 } 322 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return browser_view->exclusive_access_bubble()->GetView(); 433 return browser_view->exclusive_access_bubble()->GetView();
433 434
434 return browser_view->top_container(); 435 return browser_view->top_container();
435 } 436 }
436 437
437 views::BubbleBorder::Arrow ChooserBubbleUiView::GetAnchorArrow() { 438 views::BubbleBorder::Arrow ChooserBubbleUiView::GetAnchorArrow() {
438 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) 439 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR))
439 return views::BubbleBorder::TOP_LEFT; 440 return views::BubbleBorder::TOP_LEFT;
440 return views::BubbleBorder::NONE; 441 return views::BubbleBorder::NONE;
441 } 442 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698