Chromium Code Reviews| 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/command_line.h" | |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "content/public/browser/native_web_keyboard_event.h" | 12 #include "content/public/browser/native_web_keyboard_event.h" |
| 12 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
| 13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/browser/web_contents_delegate.h" | 15 #include "content/public/browser/web_contents_delegate.h" |
| 16 #include "content/public/common/content_switches.h" | |
| 15 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 17 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
| 16 #include "ui/views/controls/webview/webview.h" | 18 #include "ui/views/controls/webview/webview.h" |
| 17 #include "ui/views/focus/focus_manager.h" | 19 #include "ui/views/focus/focus_manager.h" |
| 18 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 19 | 21 |
| 20 namespace athena { | 22 namespace athena { |
| 21 namespace { | 23 namespace { |
| 22 | 24 |
| 23 class WebActivityController : public AcceleratorHandler { | 25 class WebActivityController : public AcceleratorHandler { |
| 24 public: | 26 public: |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 params.url)); | 215 params.url)); |
| 214 break; | 216 break; |
| 215 } | 217 } |
| 216 default: | 218 default: |
| 217 break; | 219 break; |
| 218 } | 220 } |
| 219 // NULL is returned if the URL wasn't opened immediately. | 221 // NULL is returned if the URL wasn't opened immediately. |
| 220 return NULL; | 222 return NULL; |
| 221 } | 223 } |
| 222 | 224 |
| 225 virtual bool CanOverscrollContent() const OVERRIDE { | |
| 226 const std::string value = CommandLine::ForCurrentProcess()-> | |
| 227 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); | |
| 228 return value != "0"; | |
|
oshima
2014/08/29 20:00:37
just out of curiosity, do you know why this flag u
mfomitchev
2014/08/29 20:40:50
It's actually 0/1/2.
0 = off
1 = on, default scree
oshima
2014/08/29 20:53:49
I see. Would you mind updating the comment in
ht
mfomitchev
2014/08/29 21:15:21
Done: https://codereview.chromium.org/519143002/
| |
| 229 } | |
| 230 | |
| 223 virtual void AddNewContents(content::WebContents* source, | 231 virtual void AddNewContents(content::WebContents* source, |
| 224 content::WebContents* new_contents, | 232 content::WebContents* new_contents, |
| 225 WindowOpenDisposition disposition, | 233 WindowOpenDisposition disposition, |
| 226 const gfx::Rect& initial_pos, | 234 const gfx::Rect& initial_pos, |
| 227 bool user_gesture, | 235 bool user_gesture, |
| 228 bool* was_blocked) OVERRIDE { | 236 bool* was_blocked) OVERRIDE { |
| 229 ActivityManager::Get()->AddActivity( | 237 ActivityManager::Get()->AddActivity( |
| 230 new WebActivity(new AthenaWebView(new_contents))); | 238 new WebActivity(new AthenaWebView(new_contents))); |
| 231 } | 239 } |
| 232 | 240 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 void WebActivity::DidUpdateFaviconURL( | 415 void WebActivity::DidUpdateFaviconURL( |
| 408 const std::vector<content::FaviconURL>& candidates) { | 416 const std::vector<content::FaviconURL>& candidates) { |
| 409 ActivityManager::Get()->UpdateActivity(this); | 417 ActivityManager::Get()->UpdateActivity(this); |
| 410 } | 418 } |
| 411 | 419 |
| 412 void WebActivity::DidChangeThemeColor(SkColor theme_color) { | 420 void WebActivity::DidChangeThemeColor(SkColor theme_color) { |
| 413 title_color_ = theme_color; | 421 title_color_ = theme_color; |
| 414 } | 422 } |
| 415 | 423 |
| 416 } // namespace athena | 424 } // namespace athena |
| OLD | NEW |