Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "chrome/browser/ui/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1973 // Do not handle native theme changes before the browser view is initialized. | 1973 // Do not handle native theme changes before the browser view is initialized. |
| 1974 if (!initialized_) | 1974 if (!initialized_) |
| 1975 return; | 1975 return; |
| 1976 ClientView::OnNativeThemeChanged(theme); | 1976 ClientView::OnNativeThemeChanged(theme); |
| 1977 // Don't infinitely recurse. | 1977 // Don't infinitely recurse. |
| 1978 if (!handling_theme_changed_) | 1978 if (!handling_theme_changed_) |
| 1979 UserChangedTheme(); | 1979 UserChangedTheme(); |
| 1980 chrome::MaybeShowInvertBubbleView(this); | 1980 chrome::MaybeShowInvertBubbleView(this); |
| 1981 } | 1981 } |
| 1982 | 1982 |
| 1983 void BrowserView::OnGestureEvent(ui::GestureEvent* event) { | |
| 1984 #if defined(OS_MACOSX) | |
| 1985 if (event->details().type() == ui::ET_GESTURE_SWIPE) { | |
|
sky
2017/02/10 19:08:33
Can you structure this code to be a bit more reada
themblsha
2017/02/15 17:35:34
base::Optional<int> should be a better way to do i
| |
| 1986 unsigned int command = 0; | |
|
sky
2017/02/10 19:08:33
Aren't command ids ints?
themblsha
2017/02/15 17:35:34
The code was adapted from the browser_window_contr
| |
| 1987 if (event->details().swipe_left()) | |
|
tapted
2017/02/13 11:26:24
-[BrowserWindowController swipeWithEvent:] only tr
themblsha
2017/02/15 17:35:34
In my testing the -swipeWithEvent: is always calle
tapted
2017/02/15 22:25:52
Can you comment about this where you construct the
themblsha
2017/02/16 15:27:49
Done.
| |
| 1988 command = IDC_FORWARD; | |
| 1989 else if (event->details().swipe_right()) | |
|
tapted
2017/02/13 11:26:24
I really think left/right around the right are aro
themblsha
2017/02/15 17:35:34
I originally tested the behaviour to match Safari
| |
| 1990 command = IDC_BACK; | |
| 1991 | |
| 1992 if (chrome::IsCommandEnabled(browser(), command)) { | |
| 1993 chrome::ExecuteCommandWithDisposition( | |
| 1994 browser(), command, ui::DispositionFromEventFlags(event->flags())); | |
| 1995 } | |
| 1996 return; | |
| 1997 } | |
| 1998 #endif // OS_MACOSX | |
| 1999 | |
| 2000 ClientView::OnGestureEvent(event); | |
| 2001 } | |
| 2002 | |
| 1983 /////////////////////////////////////////////////////////////////////////////// | 2003 /////////////////////////////////////////////////////////////////////////////// |
| 1984 // BrowserView, ui::AcceleratorTarget overrides: | 2004 // BrowserView, ui::AcceleratorTarget overrides: |
| 1985 | 2005 |
| 1986 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 2006 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 1987 std::map<ui::Accelerator, int>::const_iterator iter = | 2007 std::map<ui::Accelerator, int>::const_iterator iter = |
| 1988 accelerator_table_.find(accelerator); | 2008 accelerator_table_.find(accelerator); |
| 1989 DCHECK(iter != accelerator_table_.end()); | 2009 DCHECK(iter != accelerator_table_.end()); |
| 1990 int command_id = iter->second; | 2010 int command_id = iter->second; |
| 1991 | 2011 |
| 1992 if (accelerator.IsRepeat() && !IsCommandRepeatable(command_id)) | 2012 if (accelerator.IsRepeat() && !IsCommandRepeatable(command_id)) |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2637 } | 2657 } |
| 2638 | 2658 |
| 2639 extensions::ActiveTabPermissionGranter* | 2659 extensions::ActiveTabPermissionGranter* |
| 2640 BrowserView::GetActiveTabPermissionGranter() { | 2660 BrowserView::GetActiveTabPermissionGranter() { |
| 2641 content::WebContents* web_contents = GetActiveWebContents(); | 2661 content::WebContents* web_contents = GetActiveWebContents(); |
| 2642 if (!web_contents) | 2662 if (!web_contents) |
| 2643 return nullptr; | 2663 return nullptr; |
| 2644 return extensions::TabHelper::FromWebContents(web_contents) | 2664 return extensions::TabHelper::FromWebContents(web_contents) |
| 2645 ->active_tab_permission_granter(); | 2665 ->active_tab_permission_granter(); |
| 2646 } | 2666 } |
| OLD | NEW |