| 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_application.h" | 5 #include "mash/quick_launch/quick_launch_application.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 14 matching lines...) Expand all Loading... |
| 25 namespace views { | 25 namespace views { |
| 26 class AuraInit; | 26 class AuraInit; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace mash { | 29 namespace mash { |
| 30 namespace quick_launch { | 30 namespace quick_launch { |
| 31 | 31 |
| 32 class QuickLaunchUI : public views::WidgetDelegateView, | 32 class QuickLaunchUI : public views::WidgetDelegateView, |
| 33 public views::TextfieldController { | 33 public views::TextfieldController { |
| 34 public: | 34 public: |
| 35 QuickLaunchUI(mojo::Connector* connector, catalog::mojom::CatalogPtr catalog) | 35 QuickLaunchUI(shell::Connector* connector, catalog::mojom::CatalogPtr catalog) |
| 36 : connector_(connector), | 36 : connector_(connector), |
| 37 prompt_(new views::Textfield), | 37 prompt_(new views::Textfield), |
| 38 catalog_(std::move(catalog)) { | 38 catalog_(std::move(catalog)) { |
| 39 set_background(views::Background::CreateStandardPanelBackground()); | 39 set_background(views::Background::CreateStandardPanelBackground()); |
| 40 prompt_->set_controller(this); | 40 prompt_->set_controller(this); |
| 41 AddChildView(prompt_); | 41 AddChildView(prompt_); |
| 42 | 42 |
| 43 UpdateEntries(); | 43 UpdateEntries(); |
| 44 } | 44 } |
| 45 ~QuickLaunchUI() override {} | 45 ~QuickLaunchUI() override {} |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 base::Bind(&QuickLaunchUI::OnGotCatalogEntries, | 121 base::Bind(&QuickLaunchUI::OnGotCatalogEntries, |
| 122 base::Unretained(this))); | 122 base::Unretained(this))); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void OnGotCatalogEntries( | 125 void OnGotCatalogEntries( |
| 126 mojo::Map<mojo::String, catalog::mojom::CatalogEntryPtr> entries) { | 126 mojo::Map<mojo::String, catalog::mojom::CatalogEntryPtr> entries) { |
| 127 for (const auto& entry : entries) | 127 for (const auto& entry : entries) |
| 128 app_names_.insert(base::UTF8ToUTF16(entry.first.get())); | 128 app_names_.insert(base::UTF8ToUTF16(entry.first.get())); |
| 129 } | 129 } |
| 130 | 130 |
| 131 mojo::Connector* connector_; | 131 shell::Connector* connector_; |
| 132 views::Textfield* prompt_; | 132 views::Textfield* prompt_; |
| 133 std::vector<std::unique_ptr<mojo::Connection>> connections_; | 133 std::vector<std::unique_ptr<shell::Connection>> connections_; |
| 134 catalog::mojom::CatalogPtr catalog_; | 134 catalog::mojom::CatalogPtr catalog_; |
| 135 std::set<base::string16> app_names_; | 135 std::set<base::string16> app_names_; |
| 136 bool suggestion_rejected_ = false; | 136 bool suggestion_rejected_ = false; |
| 137 | 137 |
| 138 DISALLOW_COPY_AND_ASSIGN(QuickLaunchUI); | 138 DISALLOW_COPY_AND_ASSIGN(QuickLaunchUI); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 QuickLaunchApplication::QuickLaunchApplication() {} | 141 QuickLaunchApplication::QuickLaunchApplication() {} |
| 142 QuickLaunchApplication::~QuickLaunchApplication() {} | 142 QuickLaunchApplication::~QuickLaunchApplication() {} |
| 143 | 143 |
| 144 void QuickLaunchApplication::Initialize(mojo::Connector* connector, | 144 void QuickLaunchApplication::Initialize(shell::Connector* connector, |
| 145 const mojo::Identity& identity, | 145 const shell::Identity& identity, |
| 146 uint32_t id) { | 146 uint32_t id) { |
| 147 tracing_.Initialize(connector, identity.name()); | 147 tracing_.Initialize(connector, identity.name()); |
| 148 | 148 |
| 149 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); | 149 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); |
| 150 views::WindowManagerConnection::Create(connector); | 150 views::WindowManagerConnection::Create(connector); |
| 151 | 151 |
| 152 catalog::mojom::CatalogPtr catalog; | 152 catalog::mojom::CatalogPtr catalog; |
| 153 connector->ConnectToInterface("mojo:catalog", &catalog); | 153 connector->ConnectToInterface("mojo:catalog", &catalog); |
| 154 | 154 |
| 155 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( | 155 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( |
| 156 new QuickLaunchUI(connector, std::move(catalog)), nullptr, | 156 new QuickLaunchUI(connector, std::move(catalog)), nullptr, |
| 157 gfx::Rect(10, 640, 0, 0)); | 157 gfx::Rect(10, 640, 0, 0)); |
| 158 window->Show(); | 158 window->Show(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool QuickLaunchApplication::AcceptConnection(mojo::Connection* connection) { | 161 bool QuickLaunchApplication::AcceptConnection(shell::Connection* connection) { |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace quick_launch | 165 } // namespace quick_launch |
| 166 } // namespace mash | 166 } // namespace mash |
| OLD | NEW |