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 "mandoline/ui/browser/desktop/desktop_ui.h" | 5 #include "mandoline/ui/browser/desktop/desktop_ui.h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "mandoline/ui/aura/native_widget_view_manager.h" | 9 #include "mandoline/ui/aura/native_widget_view_manager.h" |
10 #include "mandoline/ui/browser/browser.h" | 10 #include "mandoline/ui/browser/browser.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 | 145 |
146 //////////////////////////////////////////////////////////////////////////////// | 146 //////////////////////////////////////////////////////////////////////////////// |
147 // DesktopUI, views::ButtonListener implementation: | 147 // DesktopUI, views::ButtonListener implementation: |
148 | 148 |
149 void DesktopUI::ButtonPressed(views::Button* sender, const ui::Event& event) { | 149 void DesktopUI::ButtonPressed(views::Button* sender, const ui::Event& event) { |
150 if (!omnibox_.get()) { | 150 if (!omnibox_.get()) { |
151 DCHECK(!client_binding_.is_bound()); | 151 DCHECK(!client_binding_.is_bound()); |
152 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 152 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
153 request->url = mojo::String::From("mojo:omnibox"); | 153 request->url = mojo::String::From("mojo:omnibox"); |
154 mojo::ApplicationConnection* application_connection = | 154 omnibox_connection_ = |
155 application_impl_->ConnectToApplication(request.Pass()); | 155 application_impl_->ConnectToApplication(request.Pass()); |
156 application_connection->AddService<ViewEmbedder>(browser_); | 156 omnibox_connection_->AddService<ViewEmbedder>(browser_); |
157 application_connection->ConnectToService(&omnibox_); | 157 omnibox_connection_->ConnectToService(&omnibox_); |
158 OmniboxClientPtr client; | 158 OmniboxClientPtr client; |
159 client_binding_.Bind(&client); | 159 client_binding_.Bind(&client); |
160 omnibox_->SetClient(client.Pass()); | 160 omnibox_->SetClient(client.Pass()); |
161 } | 161 } |
162 omnibox_->ShowForURL(mojo::String::From(browser_->current_url().spec())); | 162 omnibox_->ShowForURL(mojo::String::From(browser_->current_url().spec())); |
163 } | 163 } |
164 | 164 |
165 //////////////////////////////////////////////////////////////////////////////// | 165 //////////////////////////////////////////////////////////////////////////////// |
166 // BrowserUI, public: | 166 // BrowserUI, public: |
167 | 167 |
168 // static | 168 // static |
169 BrowserUI* BrowserUI::Create(Browser* browser, | 169 BrowserUI* BrowserUI::Create(Browser* browser, |
170 mojo::ApplicationImpl* application_impl) { | 170 mojo::ApplicationImpl* application_impl) { |
171 return new DesktopUI(browser, application_impl); | 171 return new DesktopUI(browser, application_impl); |
172 } | 172 } |
173 | 173 |
174 } // namespace mandoline | 174 } // namespace mandoline |
OLD | NEW |