OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/browser/shell.h" | 5 #include "content/shell/browser/shell.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 void Shell::Reload() { | 198 void Shell::Reload() { |
199 web_contents_->GetController().Reload(false); | 199 web_contents_->GetController().Reload(false); |
200 web_contents_->GetView()->Focus(); | 200 web_contents_->GetView()->Focus(); |
201 } | 201 } |
202 | 202 |
203 void Shell::Stop() { | 203 void Shell::Stop() { |
204 web_contents_->Stop(); | 204 web_contents_->Stop(); |
205 web_contents_->GetView()->Focus(); | 205 web_contents_->GetView()->Focus(); |
206 } | 206 } |
207 | 207 |
208 void Shell::UpdateNavigationControls() { | 208 void Shell::UpdateNavigationControls(bool to_different_document) { |
209 int current_index = web_contents_->GetController().GetCurrentEntryIndex(); | 209 int current_index = web_contents_->GetController().GetCurrentEntryIndex(); |
210 int max_index = web_contents_->GetController().GetEntryCount() - 1; | 210 int max_index = web_contents_->GetController().GetEntryCount() - 1; |
211 | 211 |
212 PlatformEnableUIControl(BACK_BUTTON, current_index > 0); | 212 PlatformEnableUIControl(BACK_BUTTON, current_index > 0); |
213 PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); | 213 PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); |
214 PlatformEnableUIControl(STOP_BUTTON, web_contents_->IsLoading()); | 214 PlatformEnableUIControl(STOP_BUTTON, |
| 215 to_different_document && web_contents_->IsLoading()); |
215 } | 216 } |
216 | 217 |
217 void Shell::ShowDevTools() { | 218 void Shell::ShowDevTools() { |
218 InnerShowDevTools(""); | 219 InnerShowDevTools(""); |
219 } | 220 } |
220 | 221 |
221 void Shell::ShowDevToolsForElementAt(int x, int y) { | 222 void Shell::ShowDevToolsForElementAt(int x, int y) { |
222 InnerShowDevTools(""); | 223 InnerShowDevTools(""); |
223 devtools_frontend_->InspectElementAt(x, y); | 224 devtools_frontend_->InspectElementAt(x, y); |
224 } | 225 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 load_url_params.transferred_global_request_id = | 260 load_url_params.transferred_global_request_id = |
260 params.transferred_global_request_id; | 261 params.transferred_global_request_id; |
261 } else if (params.is_renderer_initiated) { | 262 } else if (params.is_renderer_initiated) { |
262 load_url_params.is_renderer_initiated = true; | 263 load_url_params.is_renderer_initiated = true; |
263 } | 264 } |
264 | 265 |
265 source->GetController().LoadURLWithParams(load_url_params); | 266 source->GetController().LoadURLWithParams(load_url_params); |
266 return source; | 267 return source; |
267 } | 268 } |
268 | 269 |
269 void Shell::LoadingStateChanged(WebContents* source) { | 270 void Shell::LoadingStateChanged(WebContents* source, |
270 UpdateNavigationControls(); | 271 bool to_different_document) { |
| 272 UpdateNavigationControls(to_different_document); |
271 PlatformSetIsLoading(source->IsLoading()); | 273 PlatformSetIsLoading(source->IsLoading()); |
272 } | 274 } |
273 | 275 |
274 void Shell::ToggleFullscreenModeForTab(WebContents* web_contents, | 276 void Shell::ToggleFullscreenModeForTab(WebContents* web_contents, |
275 bool enter_fullscreen) { | 277 bool enter_fullscreen) { |
276 #if defined(OS_ANDROID) | 278 #if defined(OS_ANDROID) |
277 PlatformToggleFullscreenModeForTab(web_contents, enter_fullscreen); | 279 PlatformToggleFullscreenModeForTab(web_contents, enter_fullscreen); |
278 #endif | 280 #endif |
279 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 281 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
280 return; | 282 return; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 devtools_frontend_->Activate(); | 375 devtools_frontend_->Activate(); |
374 devtools_frontend_->Focus(); | 376 devtools_frontend_->Focus(); |
375 } | 377 } |
376 | 378 |
377 void Shell::OnDevToolsWebContentsDestroyed() { | 379 void Shell::OnDevToolsWebContentsDestroyed() { |
378 devtools_observer_.reset(); | 380 devtools_observer_.reset(); |
379 devtools_frontend_ = NULL; | 381 devtools_frontend_ = NULL; |
380 } | 382 } |
381 | 383 |
382 } // namespace content | 384 } // namespace content |
OLD | NEW |