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

Side by Side Diff: mandoline/ui/browser/browser.cc

Issue 1135933003: Get the omnibox to show up again. Sky's changes from yesterday removed the window manager interface… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 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 | « mandoline/ui/browser/browser.h ('k') | mandoline/ui/browser/view_embedder.mojom » ('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 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/browser.h" 5 #include "mandoline/ui/browser/browser.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "components/view_manager/public/cpp/view.h" 9 #include "components/view_manager/public/cpp/view.h"
10 #include "components/view_manager/public/cpp/view_manager_init.h" 10 #include "components/view_manager/public/cpp/view_manager_init.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 Browser::Browser() 33 Browser::Browser()
34 : root_(nullptr), 34 : root_(nullptr),
35 content_(nullptr), 35 content_(nullptr),
36 omnibox_(nullptr), 36 omnibox_(nullptr),
37 navigator_host_(this), 37 navigator_host_(this),
38 ui_(nullptr) { 38 ui_(nullptr) {
39 exposed_services_impl_.AddService(this); 39 exposed_services_impl_.AddService<mojo::NavigatorHost>(this);
40 } 40 }
41 41
42 Browser::~Browser() { 42 Browser::~Browser() {
43 } 43 }
44 44
45 void Browser::ReplaceContentWithURL(const mojo::String& url) { 45 void Browser::ReplaceContentWithURL(const mojo::String& url) {
46 Embed(url, nullptr, nullptr); 46 Embed(url, nullptr, nullptr);
47 } 47 }
48 48
49 void Browser::Initialize(mojo::ApplicationImpl* app) { 49 void Browser::Initialize(mojo::ApplicationImpl* app) {
(...skipping 15 matching lines...) Expand all
65 } 65 }
66 66
67 bool Browser::ConfigureIncomingConnection( 67 bool Browser::ConfigureIncomingConnection(
68 mojo::ApplicationConnection* connection) { 68 mojo::ApplicationConnection* connection) {
69 // TODO: register embed interface here. 69 // TODO: register embed interface here.
70 return true; 70 return true;
71 } 71 }
72 72
73 bool Browser::ConfigureOutgoingConnection( 73 bool Browser::ConfigureOutgoingConnection(
74 mojo::ApplicationConnection* connection) { 74 mojo::ApplicationConnection* connection) {
75 connection->AddService<ViewEmbedder>(this);
75 return true; 76 return true;
76 } 77 }
77 78
78 void Browser::OnEmbed( 79 void Browser::OnEmbed(
79 mojo::View* root, 80 mojo::View* root,
80 mojo::InterfaceRequest<mojo::ServiceProvider> services, 81 mojo::InterfaceRequest<mojo::ServiceProvider> services,
81 mojo::ServiceProviderPtr exposed_services) { 82 mojo::ServiceProviderPtr exposed_services) {
82 // Browser does not support being embedded more than once. 83 // Browser does not support being embedded more than once.
83 CHECK(!root_); 84 CHECK(!root_);
84 85
(...skipping 30 matching lines...) Expand all
115 DCHECK_EQ(mojo::KEYBOARD_CODE_BROWSER_BACK, 116 DCHECK_EQ(mojo::KEYBOARD_CODE_BROWSER_BACK,
116 event->key_data->windows_key_code); 117 event->key_data->windows_key_code);
117 navigator_host_.RequestNavigateHistory(-1); 118 navigator_host_.RequestNavigateHistory(-1);
118 } 119 }
119 120
120 void Browser::OpenURL(const mojo::String& url) { 121 void Browser::OpenURL(const mojo::String& url) {
121 omnibox_->SetVisible(false); 122 omnibox_->SetVisible(false);
122 ReplaceContentWithURL(url); 123 ReplaceContentWithURL(url);
123 } 124 }
124 125
125 void Browser::Create(mojo::ApplicationConnection* connection,
126 mojo::InterfaceRequest<mojo::NavigatorHost> request) {
127 navigator_host_.Bind(request.Pass());
128 }
129
130 void Browser::ShowOmnibox(
131 const mojo::String& url,
132 mojo::InterfaceRequest<mojo::ServiceProvider> services,
133 mojo::ServiceProviderPtr exposed_services) {
134 if (!omnibox_) {
135 omnibox_ = root_->view_manager()->CreateView();
136 root_->AddChild(omnibox_);
137 omnibox_->SetVisible(true);
138 omnibox_->SetBounds(root_->bounds());
139 }
140 omnibox_->Embed(url, services.Pass(), exposed_services.Pass());
141 }
142
143 void Browser::Embed(const mojo::String& url, 126 void Browser::Embed(const mojo::String& url,
144 mojo::InterfaceRequest<mojo::ServiceProvider> services, 127 mojo::InterfaceRequest<mojo::ServiceProvider> services,
145 mojo::ServiceProviderPtr exposed_services) { 128 mojo::ServiceProviderPtr exposed_services) {
146 if (url == "mojo:omnibox") { 129 if (url == "mojo:omnibox") {
147 ShowOmnibox(url, services.Pass(), exposed_services.Pass()); 130 ShowOmnibox(url, services.Pass(), exposed_services.Pass());
148 return; 131 return;
149 } 132 }
150 133
151 // We can get Embed calls before we've actually been 134 // We can get Embed calls before we've actually been
152 // embedded into the root view and content_ is created. 135 // embedded into the root view and content_ is created.
(...skipping 10 matching lines...) Expand all
163 ui_->OnURLChanged(); 146 ui_->OnURLChanged();
164 147
165 merged_service_provider_.reset( 148 merged_service_provider_.reset(
166 new MergedServiceProvider(exposed_services.Pass(), this)); 149 new MergedServiceProvider(exposed_services.Pass(), this));
167 content_->Embed(url, services.Pass(), 150 content_->Embed(url, services.Pass(),
168 merged_service_provider_->GetServiceProviderPtr().Pass()); 151 merged_service_provider_->GetServiceProviderPtr().Pass());
169 152
170 navigator_host_.RecordNavigation(url); 153 navigator_host_.RecordNavigation(url);
171 } 154 }
172 155
156 void Browser::Create(mojo::ApplicationConnection* connection,
157 mojo::InterfaceRequest<mojo::NavigatorHost> request) {
158 navigator_host_.Bind(request.Pass());
159 }
160
161 void Browser::Create(mojo::ApplicationConnection* connection,
162 mojo::InterfaceRequest<ViewEmbedder> request) {
163 view_embedder_bindings_.AddBinding(this, request.Pass());
164 }
165
166 void Browser::ShowOmnibox(
167 const mojo::String& url,
168 mojo::InterfaceRequest<mojo::ServiceProvider> services,
169 mojo::ServiceProviderPtr exposed_services) {
170 if (!omnibox_) {
171 omnibox_ = root_->view_manager()->CreateView();
172 root_->AddChild(omnibox_);
173 omnibox_->SetVisible(true);
174 omnibox_->SetBounds(root_->bounds());
175 }
176 omnibox_->Embed(url, services.Pass(), exposed_services.Pass());
177 }
178
173 } // namespace mandoline 179 } // namespace mandoline
OLDNEW
« no previous file with comments | « mandoline/ui/browser/browser.h ('k') | mandoline/ui/browser/view_embedder.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698