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

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

Issue 2179023004: Make Service own ServiceContext. (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 | « mash/browser/browser.h ('k') | mash/catalog_viewer/catalog_viewer.h » ('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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 void Browser::RemoveWindow(views::Widget* window) { 854 void Browser::RemoveWindow(views::Widget* window) {
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::WrapUnique(new navigation::View(std::move(factory)));
866 } 866 }
867 867
868 void Browser::OnStart(shell::Connector* connector, 868 void Browser::OnStart(const shell::Identity& identity) {
869 const shell::Identity& identity, 869 tracing_.Initialize(connector(), identity.name());
870 uint32_t id) {
871 connector_ = connector;
872 tracing_.Initialize(connector, identity.name());
873 870
874 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); 871 aura_init_.reset(
872 new views::AuraInit(connector(), "views_mus_resources.pak"));
875 window_manager_connection_ = 873 window_manager_connection_ =
876 views::WindowManagerConnection::Create(connector, identity); 874 views::WindowManagerConnection::Create(connector(), identity);
877 } 875 }
878 876
879 bool Browser::OnConnect(shell::Connection* connection) { 877 bool Browser::OnConnect(shell::Connection* connection) {
880 connection->AddInterface<mojom::Launchable>(this); 878 connection->AddInterface<mojom::Launchable>(this);
881 return true; 879 return true;
882 } 880 }
883 881
884 void Browser::Launch(uint32_t what, mojom::LaunchMode how) { 882 void Browser::Launch(uint32_t what, mojom::LaunchMode how) {
885 bool reuse = 883 bool reuse =
886 how == mojom::LaunchMode::REUSE || how == mojom::LaunchMode::DEFAULT; 884 how == mojom::LaunchMode::REUSE || how == mojom::LaunchMode::DEFAULT;
(...skipping 10 matching lines...) Expand all
897 AddWindow(window); 895 AddWindow(window);
898 } 896 }
899 897
900 void Browser::Create(const shell::Identity& remote_identity, 898 void Browser::Create(const shell::Identity& remote_identity,
901 mojom::LaunchableRequest request) { 899 mojom::LaunchableRequest request) {
902 bindings_.AddBinding(this, std::move(request)); 900 bindings_.AddBinding(this, std::move(request));
903 } 901 }
904 902
905 } // namespace browser 903 } // namespace browser
906 } // namespace mash 904 } // namespace mash
OLDNEW
« no previous file with comments | « mash/browser/browser.h ('k') | mash/catalog_viewer/catalog_viewer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698