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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.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 (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 #include "chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/app_controller_mac.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/cocoa/browser_window_utils.h" 11 #include "chrome/browser/ui/cocoa/browser_window_utils.h"
11 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" 12 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
12 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h" 13 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h"
13 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" 14 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h"
14 #include "chrome/common/extensions/extension.h" 15 #include "chrome/common/extensions/extension.h"
15 #include "content/public/browser/native_web_keyboard_event.h" 16 #include "content/public/browser/native_web_keyboard_event.h"
16 #include "content/public/browser/notification_source.h" 17 #include "content/public/browser/notification_source.h"
17 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
18 #include "content/public/browser/render_widget_host_view.h" 19 #include "content/public/browser/render_widget_host_view.h"
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 web_modal::WebContentsModalDialogHostObserver* observer) { 734 web_modal::WebContentsModalDialogHostObserver* observer) {
734 NOTIMPLEMENTED(); 735 NOTIMPLEMENTED();
735 } 736 }
736 737
737 void NativeAppWindowCocoa::WindowWillClose() { 738 void NativeAppWindowCocoa::WindowWillClose() {
738 [window_controller_ setAppWindow:NULL]; 739 [window_controller_ setAppWindow:NULL];
739 shell_window_->OnNativeWindowChanged(); 740 shell_window_->OnNativeWindowChanged();
740 shell_window_->OnNativeClose(); 741 shell_window_->OnNativeClose();
741 } 742 }
742 743
743 void NativeAppWindowCocoa::WindowDidBecomeKey() { 744 void NativeAppWindowCocoa::WindowDidBecomeKey() {
tapted 2013/06/28 04:09:43 does this happen for panel windows as well?
jackhou1 2013/07/04 01:57:55 Yeah it does. Changed to using notifications so we
744 content::RenderWidgetHostView* rwhv = 745 content::RenderWidgetHostView* rwhv =
745 web_contents()->GetRenderWidgetHostView(); 746 web_contents()->GetRenderWidgetHostView();
746 if (rwhv) 747 if (rwhv)
747 rwhv->SetActive(true); 748 rwhv->SetActive(true);
749 const extensions::Extension* app = shell_window_->extension();
750 [[NSApp delegate] setMenuBarToApp:base::SysUTF8ToNSString(app->id())
751 withTitle:base::SysUTF8ToNSString(app->name())];
748 shell_window_->OnNativeWindowActivated(); 752 shell_window_->OnNativeWindowActivated();
749 } 753 }
750 754
751 void NativeAppWindowCocoa::WindowDidResignKey() { 755 void NativeAppWindowCocoa::WindowDidResignKey() {
752 // If our app is still active and we're still the key window, ignore this 756 // If our app is still active and we're still the key window, ignore this
753 // message, since it just means that a menu extra (on the "system status bar") 757 // message, since it just means that a menu extra (on the "system status bar")
754 // was activated; we'll get another |-windowDidResignKey| if we ever really 758 // was activated; we'll get another |-windowDidResignKey| if we ever really
755 // lose key window status. 759 // lose key window status.
756 if ([NSApp isActive] && ([NSApp keyWindow] == window())) 760 if ([NSApp isActive] && ([NSApp keyWindow] == window()))
757 return; 761 return;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); 825 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]);
822 return static_cast<ShellNSWindow*>(window); 826 return static_cast<ShellNSWindow*>(window);
823 } 827 }
824 828
825 // static 829 // static
826 NativeAppWindow* NativeAppWindow::Create( 830 NativeAppWindow* NativeAppWindow::Create(
827 ShellWindow* shell_window, 831 ShellWindow* shell_window,
828 const ShellWindow::CreateParams& params) { 832 const ShellWindow::CreateParams& params) {
829 return new NativeAppWindowCocoa(shell_window, params); 833 return new NativeAppWindowCocoa(shell_window, params);
830 } 834 }
OLDNEW
« chrome/browser/app_controller_mac.mm ('K') | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698