OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "blimp/client/session/blimp_client_session_linux.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "base/message_loop/message_loop.h" | |
9 #include "blimp/client/linux/blimp_display_manager.h" | |
10 #include "ui/events/platform/platform_event_source.h" | |
11 #include "ui/gfx/geometry/size.h" | |
12 #include "url/gurl.h" | |
13 | |
14 namespace blimp { | |
15 namespace client { | |
16 namespace { | |
17 | |
18 const int kDummyTabId = 0; | |
19 | |
20 class FakeNavigationFeatureDelegate | |
21 : public NavigationFeature::NavigationFeatureDelegate { | |
22 public: | |
23 FakeNavigationFeatureDelegate(); | |
24 ~FakeNavigationFeatureDelegate(); | |
25 | |
26 // NavigationFeatureDelegate implementation. | |
27 void OnUrlChanged(int tab_id, const GURL& url) override; | |
28 void OnFaviconChanged(int tab_id, const SkBitmap& favicon) override; | |
29 void OnTitleChanged(int tab_id, const std::string& title) override; | |
30 void OnLoadingChanged(int tab_id, bool loading) override; | |
31 | |
32 private: | |
33 DISALLOW_COPY_AND_ASSIGN(FakeNavigationFeatureDelegate); | |
34 }; | |
35 | |
36 FakeNavigationFeatureDelegate::FakeNavigationFeatureDelegate() {} | |
37 | |
38 FakeNavigationFeatureDelegate::~FakeNavigationFeatureDelegate() {} | |
39 | |
40 void FakeNavigationFeatureDelegate::OnUrlChanged(int tab_id, const GURL& url) { | |
41 DVLOG(1) << "URL changed to " << url << " in tab " << tab_id; | |
42 } | |
43 | |
44 void FakeNavigationFeatureDelegate::OnFaviconChanged(int tab_id, | |
45 const SkBitmap& favicon) { | |
46 DVLOG(1) << "Favicon changed in tab " << tab_id; | |
47 } | |
48 | |
49 void FakeNavigationFeatureDelegate::OnTitleChanged(int tab_id, | |
50 const std::string& title) { | |
51 DVLOG(1) << "Title changed to " << title << " in tab " << tab_id; | |
52 } | |
53 | |
54 void FakeNavigationFeatureDelegate::OnLoadingChanged(int tab_id, bool loading) { | |
55 DVLOG(1) << "Loading status changed to " << loading << " in tab " << tab_id; | |
56 } | |
57 | |
58 } // namespace | |
59 | |
60 BlimpClientSessionLinux::BlimpClientSessionLinux() | |
61 : event_source_(ui::PlatformEventSource::CreateDefault()), | |
62 navigation_feature_delegate_(new FakeNavigationFeatureDelegate) { | |
63 blimp_display_manager_.reset(new BlimpDisplayManager(gfx::Size(800, 600), | |
64 this, | |
65 GetRenderWidgetFeature(), | |
66 GetTabControlFeature())); | |
67 GetNavigationFeature()->SetDelegate(kDummyTabId, | |
68 navigation_feature_delegate_.get()); | |
69 } | |
70 | |
71 BlimpClientSessionLinux::~BlimpClientSessionLinux() {} | |
72 | |
73 void BlimpClientSessionLinux::OnClosed() { | |
74 base::MessageLoop::current()->QuitNow(); | |
75 } | |
76 | |
77 } // namespace client | |
78 } // namespace blimp | |
OLD | NEW |