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

Unified Diff: mandoline/ui/browser/browser.cc

Issue 1136593004: Add a simple browser UI (with url bar) (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mandoline/ui/browser/browser.h ('k') | mandoline/ui/browser/browser_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mandoline/ui/browser/browser.cc
diff --git a/mandoline/ui/browser/browser.cc b/mandoline/ui/browser/browser.cc
index d6abe10e8e1b44ebf74cc59bec7b078f7086e9d1..d62d1272e29c4d4524bd641499af556a9f9b71e8 100644
--- a/mandoline/ui/browser/browser.cc
+++ b/mandoline/ui/browser/browser.cc
@@ -6,7 +6,10 @@
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
+#include "mandoline/ui/browser/browser_ui.h"
#include "mandoline/ui/browser/merged_service_provider.h"
+#include "mojo/application/application_runner_chromium.h"
+#include "third_party/mojo/src/mojo/public/c/system/main.h"
#include "ui/gfx/geometry/size.h"
namespace mandoline {
@@ -16,6 +19,7 @@ Browser::Browser()
root_(nullptr),
content_(nullptr),
navigator_host_(this),
+ ui_(nullptr),
weak_factory_(this) {
exposed_services_impl_.AddService(this);
}
@@ -29,6 +33,7 @@ base::WeakPtr<Browser> Browser::GetWeakPtr() {
void Browser::Initialize(mojo::ApplicationImpl* app) {
window_manager_app_->Initialize(app);
+ ui_.reset(BrowserUI::Create(this, app->shell()));
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
base::CommandLine::StringVector args = command_line->GetArgs();
@@ -62,8 +67,12 @@ void Browser::OnEmbed(
// Browser does not support being embedded more than once.
CHECK(!root_);
+ // TODO(beng): still unhappy with the fact that both this class & the UI class
+ // know so much about these views. Figure out how to shift more to
+ // the UI class.
root_ = root;
- root_->AddObserver(this);
+ content_ = root->view_manager()->CreateView();
+ ui_->Init(root_, content_);
#if defined(OS_ANDROID)
// Resize to match the Nexus 5 aspect ratio:
@@ -72,8 +81,6 @@ void Browser::OnEmbed(
window_manager_app_->SetViewportSize(gfx::Size(1280, 800));
#endif
- content_ = root->view_manager()->CreateView();
- content_->SetBounds(root_->bounds());
root_->AddChild(content_);
content_->SetVisible(true);
@@ -123,16 +130,6 @@ void Browser::OnViewManagerDisconnected(
root_ = nullptr;
}
-void Browser::OnViewDestroyed(mojo::View* view) {
- view->RemoveObserver(this);
-}
-
-void Browser::OnViewBoundsChanged(mojo::View* view,
- const mojo::Rect& old_bounds,
- const mojo::Rect& new_bounds) {
- content_->SetBounds(new_bounds);
-}
-
// Convenience method:
void Browser::ReplaceContentWithURL(const mojo::String& url) {
Embed(url, nullptr, nullptr);
« no previous file with comments | « mandoline/ui/browser/browser.h ('k') | mandoline/ui/browser/browser_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698