Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: ui/views/event_utils_aura.cc

Issue 202173005: Fix "unreachable code" warnings (MSVC warning 4702) in ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/shell_dialogs/select_file_dialog.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/event_utils.h" 5 #include "ui/views/event_utils.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/aura/client/screen_position_client.h" 9 #include "ui/aura/client/screen_position_client.h"
10 #include "ui/aura/window_event_dispatcher.h" 10 #include "ui/aura/window_event_dispatcher.h"
(...skipping 16 matching lines...) Expand all
27 target_window = ::WindowFromPoint(event.location().ToPOINT()); 27 target_window = ::WindowFromPoint(event.location().ToPOINT());
28 if (::GetWindowThreadProcessId(target_window, NULL) != 28 if (::GetWindowThreadProcessId(target_window, NULL) !=
29 ::GetCurrentThreadId()) 29 ::GetCurrentThreadId())
30 return false; 30 return false;
31 } else { 31 } else {
32 if (ViewsDelegate::views_delegate && 32 if (ViewsDelegate::views_delegate &&
33 !ViewsDelegate::views_delegate->IsWindowInMetro(window)) 33 !ViewsDelegate::views_delegate->IsWindowInMetro(window))
34 target_window = window->GetHost()->GetAcceleratedWidget(); 34 target_window = window->GetHost()->GetAcceleratedWidget();
35 } 35 }
36 return RepostLocatedEventWin(target_window, event); 36 return RepostLocatedEventWin(target_window, event);
37 #endif 37 #else
38 if (!window) 38 if (!window)
39 return false; 39 return false;
40 40
41 aura::Window* root_window = window->GetRootWindow(); 41 aura::Window* root_window = window->GetRootWindow();
42 42
43 gfx::Point root_loc(event.location()); 43 gfx::Point root_loc(event.location());
44 ScreenPositionClient* spc = 44 ScreenPositionClient* spc =
45 aura::client::GetScreenPositionClient(root_window); 45 aura::client::GetScreenPositionClient(root_window);
46 if (!spc) 46 if (!spc)
47 return false; 47 return false;
48 48
49 spc->ConvertPointFromScreen(root_window, &root_loc); 49 spc->ConvertPointFromScreen(root_window, &root_loc);
50 50
51 scoped_ptr<ui::LocatedEvent> relocated; 51 scoped_ptr<ui::LocatedEvent> relocated;
52 if (event.IsMouseEvent()) { 52 if (!event.IsMouseEvent()) {
53 const ui::MouseEvent& orig = static_cast<const ui::MouseEvent&>(event);
54 relocated.reset(new ui::MouseEvent(orig));
55 } else if (event.IsGestureEvent()) {
56 // TODO(rbyers): Gesture event repost is tricky to get right 53 // TODO(rbyers): Gesture event repost is tricky to get right
57 // crbug.com/170987. 54 // crbug.com/170987.
58 return false; 55 DCHECK(event.IsGestureEvent());
59 } else {
60 NOTREACHED();
61 return false; 56 return false;
62 } 57 }
58
59 const ui::MouseEvent& orig = static_cast<const ui::MouseEvent&>(event);
60 relocated.reset(new ui::MouseEvent(orig));
63 relocated->set_location(root_loc); 61 relocated->set_location(root_loc);
64 relocated->set_root_location(root_loc); 62 relocated->set_root_location(root_loc);
65 63
66 root_window->GetHost()->dispatcher()->RepostEvent(*relocated); 64 root_window->GetHost()->dispatcher()->RepostEvent(*relocated);
67 return true; 65 return true;
66 #endif
68 } 67 }
69 68
70 } // namespace views 69 } // namespace views
OLDNEW
« no previous file with comments | « ui/shell_dialogs/select_file_dialog.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698