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

Side by Side Diff: services/navigation/view_impl.h

Issue 1981623002: Add a basic browser to mash that uses the navigation service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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 | « services/navigation/public/interfaces/view.mojom ('k') | services/navigation/view_impl.cc » ('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 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 #ifndef SERVICES_NAVIGATION_VIEW_IMPL_H_ 5 #ifndef SERVICES_NAVIGATION_VIEW_IMPL_H_
6 #define SERVICES_NAVIGATION_VIEW_IMPL_H_ 6 #define SERVICES_NAVIGATION_VIEW_IMPL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "components/mus/public/cpp/window_tree_delegate.h"
9 #include "content/public/browser/web_contents_delegate.h" 10 #include "content/public/browser/web_contents_delegate.h"
10 #include "mojo/public/cpp/bindings/binding_set.h" 11 #include "mojo/public/cpp/bindings/binding_set.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h" 12 #include "mojo/public/cpp/bindings/strong_binding.h"
12 #include "services/navigation/public/interfaces/view.mojom.h" 13 #include "services/navigation/public/interfaces/view.mojom.h"
13 #include "services/shell/public/cpp/interface_factory.h" 14 #include "services/shell/public/cpp/interface_factory.h"
14 #include "services/shell/public/cpp/shell_client.h" 15 #include "services/shell/public/cpp/shell_client.h"
15 #include "services/shell/public/cpp/shell_connection_ref.h" 16 #include "services/shell/public/cpp/shell_connection_ref.h"
17 #include "ui/views/widget/widget_delegate.h"
18
19 namespace views {
20 class WebView;
21 class Widget;
22 }
16 23
17 namespace navigation { 24 namespace navigation {
18 25
19 class ViewImpl : public mojom::View, 26 class ViewImpl : public mojom::View,
20 public content::WebContentsDelegate { 27 public content::WebContentsDelegate,
28 public mus::WindowTreeDelegate,
29 public views::WidgetDelegate {
21 public: 30 public:
22 ViewImpl(content::BrowserContext* browser_context, 31 ViewImpl(shell::Connector* connector,
32 content::BrowserContext* browser_context,
23 mojom::ViewClientPtr client, 33 mojom::ViewClientPtr client,
24 mojom::ViewRequest request, 34 mojom::ViewRequest request,
25 std::unique_ptr<shell::ShellConnectionRef> ref); 35 std::unique_ptr<shell::ShellConnectionRef> ref);
26 ~ViewImpl() override; 36 ~ViewImpl() override;
27 37
28 private: 38 private:
29 // mojom::View: 39 // mojom::View:
30 void LoadUrl(const GURL& url) override; 40 void NavigateTo(const GURL& url) override;
41 void GoBack() override;
42 void GoForward() override;
43 void Reload(bool skip_cache) override;
44 void Stop() override;
45 void GetWindowTreeClient(
46 mus::mojom::WindowTreeClientRequest request) override;
31 47
32 // content::WebContentsDelegate: 48 // content::WebContentsDelegate:
49 void AddNewContents(content::WebContents* source,
50 content::WebContents* new_contents,
51 WindowOpenDisposition disposition,
52 const gfx::Rect& initial_rect,
53 bool user_gesture,
54 bool* was_blocked) override;
55 void CloseContents(content::WebContents* source) override;
33 void LoadingStateChanged(content::WebContents* source, 56 void LoadingStateChanged(content::WebContents* source,
34 bool to_different_document) override; 57 bool to_different_document) override;
58 void NavigationStateChanged(content::WebContents* source,
59 content::InvalidateTypes changed_flags) override;
60 void LoadProgressChanged(content::WebContents* source,
61 double progress) override;
35 62
63 // mus::WindowTreeDelegate:
64 void OnEmbed(mus::Window* root) override;
65 void OnConnectionLost(mus::WindowTreeConnection* connection) override;
66 void OnEventObserved(const ui::Event& event, mus::Window* target) override;
67
68 // views::WidgetDelegate:
69 views::View* GetContentsView() override;
70 views::Widget* GetWidget() override;
71 const views::Widget* GetWidget() const override;
72
73 shell::Connector* connector_;
36 mojo::StrongBinding<mojom::View> binding_; 74 mojo::StrongBinding<mojom::View> binding_;
37 mojom::ViewClientPtr client_; 75 mojom::ViewClientPtr client_;
38 std::unique_ptr<shell::ShellConnectionRef> ref_; 76 std::unique_ptr<shell::ShellConnectionRef> ref_;
39 77
78 views::WebView* web_view_;
79
40 std::unique_ptr<content::WebContents> web_contents_; 80 std::unique_ptr<content::WebContents> web_contents_;
41 81
82 std::unique_ptr<views::Widget> widget_;
83
42 DISALLOW_COPY_AND_ASSIGN(ViewImpl); 84 DISALLOW_COPY_AND_ASSIGN(ViewImpl);
43 }; 85 };
44 86
45 } // navigation 87 } // navigation
46 88
47 #endif // SERVICES_NAVIGATION_VIEW_IMPL_H_ 89 #endif // SERVICES_NAVIGATION_VIEW_IMPL_H_
OLDNEW
« no previous file with comments | « services/navigation/public/interfaces/view.mojom ('k') | services/navigation/view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698