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

Side by Side Diff: shell/application_manager/application_manager.cc

Issue 1219683015: Convert //shell/... to use set_connection_error_handler() instead of set_error_handler(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 | shell/application_manager/application_manager_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "shell/application_manager/application_manager.h" 5 #include "shell/application_manager/application_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 29 matching lines...) Expand all
40 return v2; 40 return v2;
41 if (!v2.size()) 41 if (!v2.size())
42 return v1; 42 return v1;
43 std::vector<std::string> result(v1); 43 std::vector<std::string> result(v1);
44 result.insert(result.end(), v1.begin(), v1.end()); 44 result.insert(result.end(), v1.begin(), v1.end());
45 return result; 45 return result;
46 } 46 }
47 47
48 } // namespace 48 } // namespace
49 49
50 class ApplicationManager::ContentHandlerConnection : public mojo::ErrorHandler { 50 class ApplicationManager::ContentHandlerConnection {
51 public: 51 public:
52 ContentHandlerConnection(ApplicationManager* manager, 52 ContentHandlerConnection(ApplicationManager* manager,
53 const GURL& content_handler_url) 53 const GURL& content_handler_url)
54 : manager_(manager), content_handler_url_(content_handler_url) { 54 : manager_(manager), content_handler_url_(content_handler_url) {
55 ServiceProviderPtr services; 55 ServiceProviderPtr services;
56 manager->ConnectToApplication(content_handler_url, GURL(), 56 manager->ConnectToApplication(content_handler_url, GURL(),
57 mojo::GetProxy(&services), nullptr, 57 mojo::GetProxy(&services), nullptr,
58 base::Closure()); 58 base::Closure());
59 mojo::MessagePipe pipe; 59 mojo::MessagePipe pipe;
60 content_handler_.Bind( 60 content_handler_.Bind(
61 mojo::InterfacePtrInfo<mojo::ContentHandler>(pipe.handle0.Pass(), 0u)); 61 mojo::InterfacePtrInfo<mojo::ContentHandler>(pipe.handle0.Pass(), 0u));
62 services->ConnectToService(mojo::ContentHandler::Name_, 62 services->ConnectToService(mojo::ContentHandler::Name_,
63 pipe.handle1.Pass()); 63 pipe.handle1.Pass());
64 content_handler_.set_error_handler(this); 64 content_handler_.set_connection_error_handler(
65 [this]() { manager_->OnContentHandlerError(this); });
65 } 66 }
67 ~ContentHandlerConnection() {}
66 68
67 mojo::ContentHandler* content_handler() { return content_handler_.get(); } 69 mojo::ContentHandler* content_handler() { return content_handler_.get(); }
68 70
69 GURL content_handler_url() { return content_handler_url_; } 71 GURL content_handler_url() { return content_handler_url_; }
70 72
71 private: 73 private:
72 // mojo::ErrorHandler implementation:
73 void OnConnectionError() override { manager_->OnContentHandlerError(this); }
74
75 ApplicationManager* manager_; 74 ApplicationManager* manager_;
76 GURL content_handler_url_; 75 GURL content_handler_url_;
77 mojo::ContentHandlerPtr content_handler_; 76 mojo::ContentHandlerPtr content_handler_;
78 77
79 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection); 78 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection);
80 }; 79 };
81 80
82 // static 81 // static
83 ApplicationManager::TestAPI::TestAPI(ApplicationManager* manager) 82 ApplicationManager::TestAPI::TestAPI(ApplicationManager* manager)
84 : manager_(manager) { 83 : manager_(manager) {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 return args_it->second; 505 return args_it->second;
507 return std::vector<std::string>(); 506 return std::vector<std::string>();
508 } 507 }
509 508
510 void ApplicationManager::CleanupRunner(NativeRunner* runner) { 509 void ApplicationManager::CleanupRunner(NativeRunner* runner) {
511 native_runners_.erase( 510 native_runners_.erase(
512 std::find(native_runners_.begin(), native_runners_.end(), runner)); 511 std::find(native_runners_.begin(), native_runners_.end(), runner));
513 } 512 }
514 513
515 } // namespace shell 514 } // namespace shell
OLDNEW
« no previous file with comments | « no previous file | shell/application_manager/application_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698