OLD | NEW |
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 #include "blimp/engine/session/tab.h" | 5 #include "blimp/engine/session/tab.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "blimp/common/create_blimp_message.h" | 9 #include "blimp/common/create_blimp_message.h" |
10 #include "blimp/common/proto/blimp_message.pb.h" | 10 #include "blimp/common/proto/blimp_message.pb.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 content::NavigationController::LoadURLParams params(url); | 69 content::NavigationController::LoadURLParams params(url); |
70 params.transition_type = ui::PageTransitionFromInt( | 70 params.transition_type = ui::PageTransitionFromInt( |
71 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 71 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
72 params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE; | 72 params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE; |
73 web_contents_->GetController().LoadURLWithParams(params); | 73 web_contents_->GetController().LoadURLWithParams(params); |
74 web_contents_->Focus(); | 74 web_contents_->Focus(); |
75 } | 75 } |
76 | 76 |
77 void Tab::GoBack() { | 77 void Tab::GoBack() { |
| 78 if (!web_contents_->GetController().CanGoBack()) { |
| 79 DLOG(ERROR) << "Ignoring back in tab " << tab_id_; |
| 80 return; |
| 81 } |
78 DVLOG(1) << "Back in tab " << tab_id_; | 82 DVLOG(1) << "Back in tab " << tab_id_; |
79 web_contents_->GetController().GoBack(); | 83 web_contents_->GetController().GoBack(); |
80 } | 84 } |
81 | 85 |
82 void Tab::GoForward() { | 86 void Tab::GoForward() { |
| 87 if (!web_contents_->GetController().CanGoForward()) { |
| 88 DLOG(ERROR) << "Ignoring forward in tab " << tab_id_; |
| 89 return; |
| 90 } |
83 DVLOG(1) << "Forward in tab " << tab_id_; | 91 DVLOG(1) << "Forward in tab " << tab_id_; |
84 web_contents_->GetController().GoForward(); | 92 web_contents_->GetController().GoForward(); |
85 } | 93 } |
86 | 94 |
87 void Tab::Reload() { | 95 void Tab::Reload() { |
88 DVLOG(1) << "Reload in tab " << tab_id_; | 96 DVLOG(1) << "Reload in tab " << tab_id_; |
89 web_contents_->GetController().Reload(true); | 97 web_contents_->GetController().Reload(true); |
90 } | 98 } |
91 | 99 |
92 void Tab::RenderViewCreated(content::RenderViewHost* render_view_host) { | 100 void Tab::RenderViewCreated(content::RenderViewHost* render_view_host) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 navigation_message->set_type(NavigationMessage::NAVIGATION_STATE_CHANGED); | 149 navigation_message->set_type(NavigationMessage::NAVIGATION_STATE_CHANGED); |
142 navigation_message->mutable_navigation_state_changed() | 150 navigation_message->mutable_navigation_state_changed() |
143 ->set_page_load_completed(load_status == PageLoadStatus::LOADED); | 151 ->set_page_load_completed(load_status == PageLoadStatus::LOADED); |
144 | 152 |
145 navigation_message_sender_->ProcessMessage(std::move(message), | 153 navigation_message_sender_->ProcessMessage(std::move(message), |
146 net::CompletionCallback()); | 154 net::CompletionCallback()); |
147 } | 155 } |
148 | 156 |
149 } // namespace engine | 157 } // namespace engine |
150 } // namespace blimp | 158 } // namespace blimp |
OLD | NEW |