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

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

Issue 18089012: Swap main menu with app-specific menu when app window focused. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/mac/bundle_locations.h" 11 #include "base/mac/bundle_locations.h"
12 #include "base/mac/mac_util.h" 12 #include "base/mac/mac_util.h"
13 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/app/chrome_command_ids.h" // IDC_* 15 #include "chrome/app/chrome_command_ids.h" // IDC_*
16 #include "chrome/browser/app_controller_mac.h"
16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 17 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
17 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/devtools/devtools_window.h" 19 #include "chrome/browser/devtools/devtools_window.h"
19 #include "chrome/browser/profiles/avatar_menu_model.h" 20 #include "chrome/browser/profiles/avatar_menu_model.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_info_cache.h" 22 #include "chrome/browser/profiles/profile_info_cache.h"
22 #include "chrome/browser/profiles/profile_manager.h" 23 #include "chrome/browser/profiles/profile_manager.h"
23 #include "chrome/browser/signin/signin_ui_util.h" 24 #include "chrome/browser/signin/signin_ui_util.h"
24 #include "chrome/browser/themes/theme_service.h" 25 #include "chrome/browser/themes/theme_service.h"
25 #include "chrome/browser/themes/theme_service_factory.h" 26 #include "chrome/browser/themes/theme_service_factory.h"
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 devtoolsWindow->web_contents()->GetRenderWidgetHostView(); 649 devtoolsWindow->web_contents()->GetRenderWidgetHostView();
649 if (devtoolsView && devtoolsView->HasFocus()) { 650 if (devtoolsView && devtoolsView->HasFocus()) {
650 devtoolsView->SetActive(true); 651 devtoolsView->SetActive(true);
651 return; 652 return;
652 } 653 }
653 } 654 }
654 655
655 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) 656 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView())
656 rwhv->SetActive(true); 657 rwhv->SetActive(true);
657 } 658 }
659 [[NSApp delegate] setMenuBarToChrome];
658 } 660 }
659 661
660 // Called when we are deactivated (when we lose focus). 662 // Called when we are deactivated (when we lose focus).
661 - (void)windowDidResignKey:(NSNotification*)notification { 663 - (void)windowDidResignKey:(NSNotification*)notification {
662 // If our app is still active and we're still the key window, ignore this 664 // If our app is still active and we're still the key window, ignore this
663 // message, since it just means that a menu extra (on the "system status bar") 665 // message, since it just means that a menu extra (on the "system status bar")
664 // was activated; we'll get another |-windowDidResignKey| if we ever really 666 // was activated; we'll get another |-windowDidResignKey| if we ever really
665 // lose key window status. 667 // lose key window status.
666 if ([NSApp isActive] && ([NSApp keyWindow] == [self window])) 668 if ([NSApp isActive] && ([NSApp keyWindow] == [self window]))
667 return; 669 return;
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 2264
2263 - (BOOL)supportsBookmarkBar { 2265 - (BOOL)supportsBookmarkBar {
2264 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2266 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2265 } 2267 }
2266 2268
2267 - (BOOL)isTabbedWindow { 2269 - (BOOL)isTabbedWindow {
2268 return browser_->is_type_tabbed(); 2270 return browser_->is_type_tabbed();
2269 } 2271 }
2270 2272
2271 @end // @implementation BrowserWindowController(WindowType) 2273 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698