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

Side by Side Diff: chrome/browser/ui/panels/panel_window_controller_cocoa.mm

Issue 9129013: Panel Overflow on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cr feedback Created 8 years, 10 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/panels/panel_window_controller_cocoa.h" 5 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/bundle_locations.h" 10 #include "base/mac/bundle_locations.h"
11 #include "base/mac/mac_util.h" 11 #include "base/mac/mac_util.h"
12 #include "base/sys_string_conversions.h" 12 #include "base/sys_string_conversions.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/app/chrome_command_ids.h" // IDC_* 14 #include "chrome/app/chrome_command_ids.h" // IDC_*
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/tabs/tab_strip_model.h" 16 #include "chrome/browser/tabs/tab_strip_model.h"
17 #include "chrome/browser/themes/theme_service.h" 17 #include "chrome/browser/themes/theme_service.h"
18 #include "chrome/browser/themes/theme_service_factory.h" 18 #include "chrome/browser/themes/theme_service_factory.h"
19 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_list.h" 20 #include "chrome/browser/ui/browser_list.h"
21 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 21 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
22 #import "chrome/browser/ui/cocoa/event_utils.h" 22 #import "chrome/browser/ui/cocoa/event_utils.h"
23 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" 23 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h"
24 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" 24 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h"
25 #import "chrome/browser/ui/cocoa/menu_controller.h" 25 #import "chrome/browser/ui/cocoa/menu_controller.h"
26 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h" 26 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h"
27 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" 27 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
28 #import "chrome/browser/ui/cocoa/tabs/throbber_view.h" 28 #import "chrome/browser/ui/cocoa/tabs/throbber_view.h"
29 #include "chrome/browser/ui/panels/panel.h"
30 #include "chrome/browser/ui/panels/panel_bounds_animation.h" 29 #include "chrome/browser/ui/panels/panel_bounds_animation.h"
31 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h" 30 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h"
32 #include "chrome/browser/ui/panels/panel_manager.h" 31 #include "chrome/browser/ui/panels/panel_manager.h"
33 #include "chrome/browser/ui/panels/panel_settings_menu_model.h" 32 #include "chrome/browser/ui/panels/panel_settings_menu_model.h"
34 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" 33 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h"
35 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 34 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
36 #include "chrome/common/chrome_notification_types.h" 35 #include "chrome/common/chrome_notification_types.h"
37 #include "content/browser/renderer_host/render_widget_host_view.h" 36 #include "content/browser/renderer_host/render_widget_host_view.h"
38 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
39 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 panel->SetExpansionState(Panel::EXPANDED); 527 panel->SetExpansionState(Panel::EXPANDED);
529 panel->Activate(); 528 panel->Activate();
530 } 529 }
531 } 530 }
532 531
533 - (int)titlebarHeightInScreenCoordinates { 532 - (int)titlebarHeightInScreenCoordinates {
534 NSView* titlebar = [self titlebarView]; 533 NSView* titlebar = [self titlebarView];
535 return NSHeight([titlebar convertRect:[titlebar bounds] toView:nil]); 534 return NSHeight([titlebar convertRect:[titlebar bounds] toView:nil]);
536 } 535 }
537 536
537 - (int)titlebarIconOnlyWidthInScreenCoordinates {
538 return [[self titlebarView] iconOnlyWidthInScreenCoordinates];
539 }
540
541 - (void)applyVisualStyleForStrip:(PanelStripType)newPanelStrip {
542 if (windowShim_->panel()->manager()->is_full_screen())
543 return;
544 [[self window] setLevel:(newPanelStrip == OVERFLOW_STRIP ?
545 NSStatusWindowLevel + 1 : NSStatusWindowLevel)];
546 }
547
538 // TODO(dcheng): These two selectors are almost copy-and-paste from 548 // TODO(dcheng): These two selectors are almost copy-and-paste from
539 // BrowserWindowController. Figure out the appropriate way of code sharing, 549 // BrowserWindowController. Figure out the appropriate way of code sharing,
540 // whether it's refactoring more things into BrowserWindowUtils or making a 550 // whether it's refactoring more things into BrowserWindowUtils or making a
541 // common base controller for browser windows. 551 // common base controller for browser windows.
542 - (void)windowDidBecomeKey:(NSNotification*)notification { 552 - (void)windowDidBecomeKey:(NSNotification*)notification {
543 BrowserList::SetLastActive(windowShim_->browser()); 553 BrowserList::SetLastActive(windowShim_->browser());
544 554
545 // We need to activate the controls (in the "WebView"). To do this, get the 555 // We need to activate the controls (in the "WebView"). To do this, get the
546 // selected TabContents's RenderWidgetHostView and tell it to activate. 556 // selected TabContents's RenderWidgetHostView and tell it to activate.
547 if (WebContents* contents = [contentsController_ webContents]) { 557 if (WebContents* contents = [contentsController_ webContents]) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 - (BOOL)canBecomeKeyWindow { 614 - (BOOL)canBecomeKeyWindow {
605 // Panel can only gain focus if it is expanded. Minimized panels do not 615 // Panel can only gain focus if it is expanded. Minimized panels do not
606 // participate in Cmd-~ rotation. 616 // participate in Cmd-~ rotation.
607 // TODO(dimich): If it will be ever desired to expand/focus the Panel on 617 // TODO(dimich): If it will be ever desired to expand/focus the Panel on
608 // keyboard navigation or via main menu, the care should be taken to avoid 618 // keyboard navigation or via main menu, the care should be taken to avoid
609 // cases when minimized Panel is getting keyboard input, invisibly. 619 // cases when minimized Panel is getting keyboard input, invisibly.
610 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; 620 return windowShim_->panel()->expansion_state() == Panel::EXPANDED;
611 } 621 }
612 622
613 @end 623 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698