| OLD | NEW |
| 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/quick_launch/quick_launch.h" | 5 #include "mash/quick_launch/quick_launch.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 prompt_->SelectRange(range); | 107 prompt_->SelectRange(range); |
| 108 break; | 108 break; |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 std::string Canonicalize(const base::string16& input) const { | 113 std::string Canonicalize(const base::string16& input) const { |
| 114 base::string16 working; | 114 base::string16 working; |
| 115 base::TrimWhitespace(input, base::TRIM_ALL, &working); | 115 base::TrimWhitespace(input, base::TRIM_ALL, &working); |
| 116 GURL url(working); | 116 GURL url(working); |
| 117 if (url.scheme() != "mojo" && url.scheme() != "exe") | 117 if (url.scheme() != "service" && url.scheme() != "exe") |
| 118 working = base::ASCIIToUTF16("mojo:") + working; | 118 working = base::ASCIIToUTF16("service:") + working; |
| 119 return base::UTF16ToUTF8(working); | 119 return base::UTF16ToUTF8(working); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void UpdateEntries() { | 122 void UpdateEntries() { |
| 123 catalog_->GetEntriesProvidingClass( | 123 catalog_->GetEntriesProvidingClass( |
| 124 "mash:launchable", | 124 "mash:launchable", |
| 125 base::Bind(&QuickLaunchUI::OnGotCatalogEntries, | 125 base::Bind(&QuickLaunchUI::OnGotCatalogEntries, |
| 126 base::Unretained(this))); | 126 base::Unretained(this))); |
| 127 } | 127 } |
| 128 | 128 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 void QuickLaunch::Launch(uint32_t what, mojom::LaunchMode how) { | 183 void QuickLaunch::Launch(uint32_t what, mojom::LaunchMode how) { |
| 184 bool reuse = how == mojom::LaunchMode::REUSE || | 184 bool reuse = how == mojom::LaunchMode::REUSE || |
| 185 how == mojom::LaunchMode::DEFAULT; | 185 how == mojom::LaunchMode::DEFAULT; |
| 186 if (reuse && !windows_.empty()) { | 186 if (reuse && !windows_.empty()) { |
| 187 windows_.back()->Activate(); | 187 windows_.back()->Activate(); |
| 188 return; | 188 return; |
| 189 } | 189 } |
| 190 catalog::mojom::CatalogPtr catalog; | 190 catalog::mojom::CatalogPtr catalog; |
| 191 connector()->ConnectToInterface("mojo:catalog", &catalog); | 191 connector()->ConnectToInterface("service:catalog", &catalog); |
| 192 | 192 |
| 193 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( | 193 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( |
| 194 new QuickLaunchUI(this, connector(), std::move(catalog)), | 194 new QuickLaunchUI(this, connector(), std::move(catalog)), |
| 195 nullptr, gfx::Rect(10, 640, 0, 0)); | 195 nullptr, gfx::Rect(10, 640, 0, 0)); |
| 196 window->Show(); | 196 window->Show(); |
| 197 windows_.push_back(window); | 197 windows_.push_back(window); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void QuickLaunch::Create(const shell::Identity& remote_identity, | 200 void QuickLaunch::Create(const shell::Identity& remote_identity, |
| 201 mojom::LaunchableRequest request) { | 201 mojom::LaunchableRequest request) { |
| 202 bindings_.AddBinding(this, std::move(request)); | 202 bindings_.AddBinding(this, std::move(request)); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace quick_launch | 205 } // namespace quick_launch |
| 206 } // namespace mash | 206 } // namespace mash |
| OLD | NEW |