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

Side by Side Diff: chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm

Issue 10391158: Moves methods for finding browsers to browser_finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include fixs Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat e.h" 5 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat e.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/mac/closure_blocks_leopard_compat.h" 9 #include "base/mac/closure_blocks_leopard_compat.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "chrome/browser/debugger/devtools_window.h" 11 #include "chrome/browser/debugger/devtools_window.h"
12 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" 12 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_finder.h"
15 #import "chrome/browser/ui/cocoa/history_overlay_controller.h" 15 #import "chrome/browser/ui/cocoa/history_overlay_controller.h"
16 #import "chrome/browser/ui/cocoa/view_id_util.h" 16 #import "chrome/browser/ui/cocoa/view_id_util.h"
17 #include "chrome/common/spellcheck_messages.h" 17 #include "chrome/common/spellcheck_messages.h"
18 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
19 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
20 #include "content/public/browser/render_view_host_observer.h" 20 #include "content/public/browser/render_view_host_observer.h"
21 #include "content/public/browser/render_widget_host.h" 21 #include "content/public/browser/render_widget_host.h"
22 #include "content/public/browser/render_widget_host_view.h" 22 #include "content/public/browser/render_widget_host_view.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 24
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 if (!renderWidgetHost_ || !renderWidgetHost_->IsRenderView()) 170 if (!renderWidgetHost_ || !renderWidgetHost_->IsRenderView())
171 return NO; 171 return NO;
172 if (DevToolsWindow::IsDevToolsWindow( 172 if (DevToolsWindow::IsDevToolsWindow(
173 RenderViewHost::From(renderWidgetHost_))) { 173 RenderViewHost::From(renderWidgetHost_))) {
174 return NO; 174 return NO;
175 } 175 }
176 176
177 if (gotUnhandledWheelEvent_ && 177 if (gotUnhandledWheelEvent_ &&
178 [NSEvent isSwipeTrackingFromScrollEventsEnabled] && 178 [NSEvent isSwipeTrackingFromScrollEventsEnabled] &&
179 [theEvent phase] == NSEventPhaseChanged) { 179 [theEvent phase] == NSEventPhaseChanged) {
180 Browser* browser = BrowserList::FindBrowserWithWindow([theEvent window]); 180 Browser* browser = browser::FindBrowserWithWindow([theEvent window]);
181 totalScrollDelta_.width += [theEvent scrollingDeltaX]; 181 totalScrollDelta_.width += [theEvent scrollingDeltaX];
182 totalScrollDelta_.height += [theEvent scrollingDeltaY]; 182 totalScrollDelta_.height += [theEvent scrollingDeltaY];
183 183
184 bool isHorizontalGesture = 184 bool isHorizontalGesture =
185 std::abs(totalScrollDelta_.width) > std::abs(totalScrollDelta_.height); 185 std::abs(totalScrollDelta_.width) > std::abs(totalScrollDelta_.height);
186 186
187 bool isRightScroll = [theEvent scrollingDeltaX] < 0; 187 bool isRightScroll = [theEvent scrollingDeltaX] < 0;
188 bool goForward = isRightScroll; 188 bool goForward = isRightScroll;
189 bool canGoBack = false, canGoForward = false; 189 bool canGoBack = false, canGoForward = false;
190 if (browser) { 190 if (browser) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 BOOL ended = phase == NSEventPhaseEnded; 252 BOOL ended = phase == NSEventPhaseEnded;
253 253
254 // Dismiss the panel before navigation for immediate visual feedback. 254 // Dismiss the panel before navigation for immediate visual feedback.
255 [historyOverlay setProgress:gestureAmount]; 255 [historyOverlay setProgress:gestureAmount];
256 if (ended) 256 if (ended)
257 [historyOverlay dismiss]; 257 [historyOverlay dismiss];
258 258
259 // |gestureAmount| obeys -[NSEvent isDirectionInvertedFromDevice] 259 // |gestureAmount| obeys -[NSEvent isDirectionInvertedFromDevice]
260 // automatically. 260 // automatically.
261 Browser* browser = BrowserList::FindBrowserWithWindow( 261 Browser* browser = browser::FindBrowserWithWindow(
262 historyOverlay.view.window); 262 historyOverlay.view.window);
263 if (ended && browser) { 263 if (ended && browser) {
264 if (goForward) 264 if (goForward)
265 browser->GoForward(CURRENT_TAB); 265 browser->GoForward(CURRENT_TAB);
266 else 266 else
267 browser->GoBack(CURRENT_TAB); 267 browser->GoBack(CURRENT_TAB);
268 } 268 }
269 269
270 if (isComplete) 270 if (isComplete)
271 [historyOverlay release]; 271 [historyOverlay release];
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 351 }
352 352
353 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked { 353 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked {
354 spellcheckEnabled_ = enabled; 354 spellcheckEnabled_ = enabled;
355 spellcheckChecked_ = checked; 355 spellcheckChecked_ = checked;
356 } 356 }
357 357
358 // END Spellchecking methods 358 // END Spellchecking methods
359 359
360 @end 360 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698