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

Side by Side Diff: mash/browser/browser.cc

Issue 2260443002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | mash/task_viewer/task_viewer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "mash/browser/browser.h" 5 #include "mash/browser/browser.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 781
782 // NavButton::ModelProvider: 782 // NavButton::ModelProvider:
783 std::unique_ptr<ui::MenuModel> CreateMenuModel( 783 std::unique_ptr<ui::MenuModel> CreateMenuModel(
784 NavButton::Type type) override { 784 NavButton::Type type) override {
785 std::vector<navigation::NavigationListItem> entries; 785 std::vector<navigation::NavigationListItem> entries;
786 if (type == NavButton::Type::BACK) { 786 if (type == NavButton::Type::BACK) {
787 selected_view()->GetBackMenuItems(&entries); 787 selected_view()->GetBackMenuItems(&entries);
788 } else { 788 } else {
789 selected_view()->GetForwardMenuItems(&entries); 789 selected_view()->GetForwardMenuItems(&entries);
790 } 790 }
791 return base::WrapUnique(new NavMenuModel(entries, this)); 791 return base::MakeUnique<NavMenuModel>(entries, this);
792 } 792 }
793 793
794 // NavMenuModel::Delegate: 794 // NavMenuModel::Delegate:
795 void NavigateToOffset(int offset) override { 795 void NavigateToOffset(int offset) override {
796 selected_view()->NavigateToOffset(offset); 796 selected_view()->NavigateToOffset(offset);
797 } 797 }
798 798
799 navigation::View* selected_view() { 799 navigation::View* selected_view() {
800 return const_cast<navigation::View*>( 800 return const_cast<navigation::View*>(
801 static_cast<const UI*>(this)->selected_view()); 801 static_cast<const UI*>(this)->selected_view());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 auto it = std::find(windows_.begin(), windows_.end(), window); 855 auto it = std::find(windows_.begin(), windows_.end(), window);
856 DCHECK(it != windows_.end()); 856 DCHECK(it != windows_.end());
857 windows_.erase(it); 857 windows_.erase(it);
858 if (windows_.empty()) 858 if (windows_.empty())
859 base::MessageLoop::current()->QuitWhenIdle(); 859 base::MessageLoop::current()->QuitWhenIdle();
860 } 860 }
861 861
862 std::unique_ptr<navigation::View> Browser::CreateView() { 862 std::unique_ptr<navigation::View> Browser::CreateView() {
863 navigation::mojom::ViewFactoryPtr factory; 863 navigation::mojom::ViewFactoryPtr factory;
864 connector()->ConnectToInterface("exe:navigation", &factory); 864 connector()->ConnectToInterface("exe:navigation", &factory);
865 return base::WrapUnique(new navigation::View(std::move(factory))); 865 return base::MakeUnique<navigation::View>(std::move(factory));
866 } 866 }
867 867
868 void Browser::OnStart(const shell::Identity& identity) { 868 void Browser::OnStart(const shell::Identity& identity) {
869 tracing_.Initialize(connector(), identity.name()); 869 tracing_.Initialize(connector(), identity.name());
870 870
871 aura_init_.reset( 871 aura_init_.reset(
872 new views::AuraInit(connector(), "views_mus_resources.pak")); 872 new views::AuraInit(connector(), "views_mus_resources.pak"));
873 window_manager_connection_ = 873 window_manager_connection_ =
874 views::WindowManagerConnection::Create(connector(), identity); 874 views::WindowManagerConnection::Create(connector(), identity);
875 } 875 }
(...skipping 20 matching lines...) Expand all
896 AddWindow(window); 896 AddWindow(window);
897 } 897 }
898 898
899 void Browser::Create(const shell::Identity& remote_identity, 899 void Browser::Create(const shell::Identity& remote_identity,
900 mojom::LaunchableRequest request) { 900 mojom::LaunchableRequest request) {
901 bindings_.AddBinding(this, std::move(request)); 901 bindings_.AddBinding(this, std::move(request));
902 } 902 }
903 903
904 } // namespace browser 904 } // namespace browser
905 } // namespace mash 905 } // namespace mash
OLDNEW
« no previous file with comments | « no previous file | mash/task_viewer/task_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698