| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/content/web_activity.h" | 5 #include "athena/content/web_activity.h" |
| 6 | 6 |
| 7 #include "athena/activity/public/activity_factory.h" | 7 #include "athena/activity/public/activity_factory.h" |
| 8 #include "athena/activity/public/activity_manager.h" | 8 #include "athena/activity/public/activity_manager.h" |
| 9 #include "athena/input/public/accelerator_manager.h" | 9 #include "athena/input/public/accelerator_manager.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "content/public/browser/native_web_keyboard_event.h" | 13 #include "content/public/browser/native_web_keyboard_event.h" |
| 13 #include "content/public/browser/navigation_controller.h" | 14 #include "content/public/browser/navigation_controller.h" |
| 14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/browser/web_contents_delegate.h" | 16 #include "content/public/browser/web_contents_delegate.h" |
| 17 #include "content/public/common/content_switches.h" |
| 16 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 17 #include "ui/compositor/closure_animation_observer.h" | 19 #include "ui/compositor/closure_animation_observer.h" |
| 18 #include "ui/compositor/scoped_layer_animation_settings.h" | 20 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 19 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 21 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
| 20 #include "ui/views/controls/webview/webview.h" | 22 #include "ui/views/controls/webview/webview.h" |
| 21 #include "ui/views/focus/focus_manager.h" | 23 #include "ui/views/focus/focus_manager.h" |
| 22 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| 23 | 25 |
| 24 namespace athena { | 26 namespace athena { |
| 25 namespace { | 27 namespace { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 params.url)); | 226 params.url)); |
| 225 break; | 227 break; |
| 226 } | 228 } |
| 227 default: | 229 default: |
| 228 break; | 230 break; |
| 229 } | 231 } |
| 230 // NULL is returned if the URL wasn't opened immediately. | 232 // NULL is returned if the URL wasn't opened immediately. |
| 231 return NULL; | 233 return NULL; |
| 232 } | 234 } |
| 233 | 235 |
| 236 virtual bool CanOverscrollContent() const OVERRIDE { |
| 237 const std::string value = CommandLine::ForCurrentProcess()-> |
| 238 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); |
| 239 return value != "0"; |
| 240 } |
| 241 |
| 234 virtual void AddNewContents(content::WebContents* source, | 242 virtual void AddNewContents(content::WebContents* source, |
| 235 content::WebContents* new_contents, | 243 content::WebContents* new_contents, |
| 236 WindowOpenDisposition disposition, | 244 WindowOpenDisposition disposition, |
| 237 const gfx::Rect& initial_pos, | 245 const gfx::Rect& initial_pos, |
| 238 bool user_gesture, | 246 bool user_gesture, |
| 239 bool* was_blocked) OVERRIDE { | 247 bool* was_blocked) OVERRIDE { |
| 240 ActivityManager::Get()->AddActivity( | 248 ActivityManager::Get()->AddActivity( |
| 241 new WebActivity(new AthenaWebView(new_contents))); | 249 new WebActivity(new AthenaWebView(new_contents))); |
| 242 } | 250 } |
| 243 | 251 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 void WebActivity::DidUpdateFaviconURL( | 466 void WebActivity::DidUpdateFaviconURL( |
| 459 const std::vector<content::FaviconURL>& candidates) { | 467 const std::vector<content::FaviconURL>& candidates) { |
| 460 ActivityManager::Get()->UpdateActivity(this); | 468 ActivityManager::Get()->UpdateActivity(this); |
| 461 } | 469 } |
| 462 | 470 |
| 463 void WebActivity::DidChangeThemeColor(SkColor theme_color) { | 471 void WebActivity::DidChangeThemeColor(SkColor theme_color) { |
| 464 title_color_ = theme_color; | 472 title_color_ = theme_color; |
| 465 } | 473 } |
| 466 | 474 |
| 467 } // namespace athena | 475 } // namespace athena |
| OLD | NEW |