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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 6874030: Commit Instant if needed before handling a web page context menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 8
9 #include "app/mac/scoped_nsdisable_screen_updates.h" 9 #include "app/mac/scoped_nsdisable_screen_updates.h"
10 #include "app/mac/nsimage_cache.h" 10 #include "app/mac/nsimage_cache.h"
11 #include "base/mac/mac_util.h" 11 #include "base/mac/mac_util.h"
12 #import "base/memory/scoped_nsobject.h" 12 #import "base/memory/scoped_nsobject.h"
13 #include "base/sys_string_conversions.h" 13 #include "base/sys_string_conversions.h"
14 #include "chrome/app/chrome_command_ids.h" // IDC_* 14 #include "chrome/app/chrome_command_ids.h" // IDC_*
15 #include "chrome/browser/bookmarks/bookmark_editor.h" 15 #include "chrome/browser/bookmarks/bookmark_editor.h"
16 #include "chrome/browser/google/google_util.h" 16 #include "chrome/browser/google/google_util.h"
17 #include "chrome/browser/instant/instant_controller.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/sync/profile_sync_service.h" 19 #include "chrome/browser/sync/profile_sync_service.h"
19 #include "chrome/browser/sync/sync_ui_util_mac.h" 20 #include "chrome/browser/sync/sync_ui_util_mac.h"
20 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" 21 #include "chrome/browser/tab_contents/tab_contents_view_mac.h"
21 #include "chrome/browser/tabs/tab_strip_model.h" 22 #include "chrome/browser/tabs/tab_strip_model.h"
22 #include "chrome/browser/themes/theme_service.h" 23 #include "chrome/browser/themes/theme_service.h"
23 #include "chrome/browser/themes/theme_service_factory.h" 24 #include "chrome/browser/themes/theme_service_factory.h"
24 #include "chrome/browser/ui/browser.h" 25 #include "chrome/browser/ui/browser.h"
25 #include "chrome/browser/ui/browser_list.h" 26 #include "chrome/browser/ui/browser_list.h"
26 #import "chrome/browser/ui/cocoa/background_gradient_view.h" 27 #import "chrome/browser/ui/cocoa/background_gradient_view.h"
(...skipping 29 matching lines...) Expand all
56 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 57 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
57 #include "chrome/browser/ui/window_sizer.h" 58 #include "chrome/browser/ui/window_sizer.h"
58 #include "chrome/common/url_constants.h" 59 #include "chrome/common/url_constants.h"
59 #include "content/browser/renderer_host/render_widget_host_view.h" 60 #include "content/browser/renderer_host/render_widget_host_view.h"
60 #include "content/browser/tab_contents/tab_contents.h" 61 #include "content/browser/tab_contents/tab_contents.h"
61 #include "grit/generated_resources.h" 62 #include "grit/generated_resources.h"
62 #include "grit/locale_settings.h" 63 #include "grit/locale_settings.h"
63 #include "ui/base/l10n/l10n_util.h" 64 #include "ui/base/l10n/l10n_util.h"
64 #include "ui/base/l10n/l10n_util_mac.h" 65 #include "ui/base/l10n/l10n_util_mac.h"
65 66
67
66 // ORGANIZATION: This is a big file. It is (in principle) organized as follows 68 // ORGANIZATION: This is a big file. It is (in principle) organized as follows
67 // (in order): 69 // (in order):
68 // 1. Interfaces. Very short, one-time-use classes may include an implementation 70 // 1. Interfaces. Very short, one-time-use classes may include an implementation
69 // immediately after their interface. 71 // immediately after their interface.
70 // 2. The general implementation section, ordered as follows: 72 // 2. The general implementation section, ordered as follows:
71 // i. Public methods and overrides. 73 // i. Public methods and overrides.
72 // ii. Overrides/implementations of undocumented methods. 74 // ii. Overrides/implementations of undocumented methods.
73 // iii. Delegate methods for various protocols, formal and informal, to which 75 // iii. Delegate methods for various protocols, formal and informal, to which
74 // |BrowserWindowController| conforms. 76 // |BrowserWindowController| conforms.
75 // 3. (temporary) Implementation sections for various categories. 77 // 3. (temporary) Implementation sections for various categories.
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 - (void)hideInstant { 1854 - (void)hideInstant {
1853 // TODO(rohitrao): Revisit whether or not this method should be called when 1855 // TODO(rohitrao): Revisit whether or not this method should be called when
1854 // instant isn't showing. 1856 // instant isn't showing.
1855 if (![previewableContentsController_ isShowingPreview]) 1857 if (![previewableContentsController_ isShowingPreview])
1856 return; 1858 return;
1857 1859
1858 [previewableContentsController_ hidePreview]; 1860 [previewableContentsController_ hidePreview];
1859 [self updateBookmarkBarVisibilityWithAnimation:NO]; 1861 [self updateBookmarkBarVisibilityWithAnimation:NO];
1860 } 1862 }
1861 1863
1864 - (void)commitInstant {
1865 InstantController::CommitIfCurrent(browser_->instant());
1866 }
1867
1868
1862 - (NSRect)instantFrame { 1869 - (NSRect)instantFrame {
1863 // The view's bounds are in its own coordinate system. Convert that to the 1870 // The view's bounds are in its own coordinate system. Convert that to the
1864 // window base coordinate system, then translate it into the screen's 1871 // window base coordinate system, then translate it into the screen's
1865 // coordinate system. 1872 // coordinate system.
1866 NSView* view = [previewableContentsController_ view]; 1873 NSView* view = [previewableContentsController_ view];
1867 if (!view) 1874 if (!view)
1868 return NSZeroRect; 1875 return NSZeroRect;
1869 1876
1870 NSRect frame = [view convertRect:[view bounds] toView:nil]; 1877 NSRect frame = [view convertRect:[view bounds] toView:nil];
1871 NSPoint originInScreenCoords = 1878 NSPoint originInScreenCoords =
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 2175
2169 - (BOOL)supportsBookmarkBar { 2176 - (BOOL)supportsBookmarkBar {
2170 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2177 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2171 } 2178 }
2172 2179
2173 - (BOOL)isNormalWindow { 2180 - (BOOL)isNormalWindow {
2174 return browser_->type() == Browser::TYPE_NORMAL; 2181 return browser_->type() == Browser::TYPE_NORMAL;
2175 } 2182 }
2176 2183
2177 @end // @implementation BrowserWindowController(WindowType) 2184 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698