OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" | |
6 | |
7 #include "blimp/client/core/contents/blimp_navigation_controller_delegate.h" | |
8 | |
9 namespace blimp { | |
10 namespace client { | |
11 | |
12 BlimpNavigationControllerImpl::BlimpNavigationControllerImpl( | |
13 int blimp_contents_id, | |
14 BlimpNavigationControllerDelegate* delegate, | |
15 NavigationFeature* feature) | |
16 : blimp_contents_id_(blimp_contents_id), | |
17 navigation_feature_(feature), | |
18 delegate_(delegate) { | |
19 if (navigation_feature_) | |
20 navigation_feature_->SetDelegate(blimp_contents_id_, this); | |
21 } | |
22 | |
23 BlimpNavigationControllerImpl::~BlimpNavigationControllerImpl() { | |
24 if (navigation_feature_) | |
25 navigation_feature_->RemoveDelegate(blimp_contents_id_); | |
26 } | |
27 | |
28 void BlimpNavigationControllerImpl::LoadURL(const GURL& url) { | |
29 current_url_ = url; | |
30 navigation_feature_->NavigateToUrlText(blimp_contents_id_, | |
31 current_url_.spec()); | |
32 } | |
33 | |
34 void BlimpNavigationControllerImpl::Reload() { | |
35 navigation_feature_->Reload(blimp_contents_id_); | |
36 } | |
37 | |
38 bool BlimpNavigationControllerImpl::CanGoBack() const { | |
39 NOTIMPLEMENTED(); | |
40 return true; | |
41 } | |
42 | |
43 bool BlimpNavigationControllerImpl::CanGoForward() const { | |
44 NOTIMPLEMENTED(); | |
45 return true; | |
46 } | |
47 | |
48 void BlimpNavigationControllerImpl::GoBack() { | |
49 navigation_feature_->GoBack(blimp_contents_id_); | |
50 } | |
51 | |
52 void BlimpNavigationControllerImpl::GoForward() { | |
53 navigation_feature_->GoForward(blimp_contents_id_); | |
54 } | |
55 | |
56 const GURL& BlimpNavigationControllerImpl::GetURL() { | |
57 return current_url_; | |
58 } | |
59 | |
60 const std::string& BlimpNavigationControllerImpl::GetTitle() { | |
61 return current_title_; | |
62 } | |
63 | |
64 void BlimpNavigationControllerImpl::OnUrlChanged(int tab_id, const GURL& url) { | |
65 current_url_ = url; | |
66 delegate_->OnNavigationStateChanged(); | |
67 } | |
68 | |
69 void BlimpNavigationControllerImpl::OnFaviconChanged(int tab_id, | |
70 const SkBitmap& favicon) { | |
71 delegate_->OnNavigationStateChanged(); | |
72 } | |
73 | |
74 void BlimpNavigationControllerImpl::OnTitleChanged(int tab_id, | |
75 const std::string& title) { | |
76 current_title_ = title; | |
77 delegate_->OnNavigationStateChanged(); | |
78 } | |
79 | |
80 void BlimpNavigationControllerImpl::OnLoadingChanged(int tab_id, bool loading) { | |
81 delegate_->OnNavigationStateChanged(); | |
82 delegate_->OnLoadingStateChanged(loading); | |
83 } | |
84 | |
85 void BlimpNavigationControllerImpl::OnPageLoadStatusUpdate(int tab_id, | |
86 bool completed) { | |
87 delegate_->OnNavigationStateChanged(); | |
88 delegate_->OnPageLoadingStateChanged(!completed); | |
89 } | |
90 | |
91 } // namespace client | |
92 } // namespace blimp | |
OLD | NEW |