OLD | NEW |
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 "mash/browser_driver/browser_driver_application_delegate.h" | 5 #include "mash/browser_driver/browser_driver_application_delegate.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "components/mus/public/cpp/event_matcher.h" | 10 #include "components/mus/public/cpp/event_matcher.h" |
11 #include "mojo/shell/public/cpp/application_connection.h" | 11 #include "mojo/shell/public/cpp/connection.h" |
12 #include "mojo/shell/public/cpp/shell.h" | 12 #include "mojo/shell/public/cpp/shell.h" |
13 | 13 |
14 namespace mash { | 14 namespace mash { |
15 namespace browser_driver { | 15 namespace browser_driver { |
16 namespace { | 16 namespace { |
17 | 17 |
18 enum class Accelerator : uint32_t { | 18 enum class Accelerator : uint32_t { |
19 NewWindow, | 19 NewWindow, |
20 NewTab, | 20 NewTab, |
21 NewIncognitoWindow, | 21 NewIncognitoWindow, |
(...skipping 29 matching lines...) Expand all Loading... |
51 BrowserDriverApplicationDelegate::~BrowserDriverApplicationDelegate() {} | 51 BrowserDriverApplicationDelegate::~BrowserDriverApplicationDelegate() {} |
52 | 52 |
53 void BrowserDriverApplicationDelegate::Initialize(mojo::Shell* shell, | 53 void BrowserDriverApplicationDelegate::Initialize(mojo::Shell* shell, |
54 const std::string& url, | 54 const std::string& url, |
55 uint32_t id) { | 55 uint32_t id) { |
56 shell_ = shell; | 56 shell_ = shell; |
57 AddAccelerators(); | 57 AddAccelerators(); |
58 } | 58 } |
59 | 59 |
60 bool BrowserDriverApplicationDelegate::AcceptConnection( | 60 bool BrowserDriverApplicationDelegate::AcceptConnection( |
61 mojo::ApplicationConnection* connection) { | 61 mojo::Connection* connection) { |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
65 void BrowserDriverApplicationDelegate::OnAccelerator( | 65 void BrowserDriverApplicationDelegate::OnAccelerator( |
66 uint32_t id, mus::mojom::EventPtr event) { | 66 uint32_t id, mus::mojom::EventPtr event) { |
67 switch (static_cast<Accelerator>(id)) { | 67 switch (static_cast<Accelerator>(id)) { |
68 case Accelerator::NewWindow: | 68 case Accelerator::NewWindow: |
69 case Accelerator::NewTab: | 69 case Accelerator::NewTab: |
70 case Accelerator::NewIncognitoWindow: | 70 case Accelerator::NewIncognitoWindow: |
71 shell_->ConnectToApplication("exe:chrome"); | 71 shell_->ConnectToApplication("exe:chrome"); |
(...skipping 24 matching lines...) Expand all Loading... |
96 for (const AcceleratorSpec& spec : g_spec) { | 96 for (const AcceleratorSpec& spec : g_spec) { |
97 registrar->AddAccelerator( | 97 registrar->AddAccelerator( |
98 static_cast<uint32_t>(spec.id), | 98 static_cast<uint32_t>(spec.id), |
99 mus::CreateKeyMatcher(spec.keyboard_code, spec.event_flags), | 99 mus::CreateKeyMatcher(spec.keyboard_code, spec.event_flags), |
100 base::Bind(&AssertTrue)); | 100 base::Bind(&AssertTrue)); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 } // namespace browser_driver | 104 } // namespace browser_driver |
105 } // namespace main | 105 } // namespace main |
OLD | NEW |