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

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

Issue 9420007: Move RenderWidgetHostView into content namespace. Fix include paths. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix linux_chromeos_gtk build issue not caught by trybots. 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"
(...skipping 16 matching lines...) Expand all
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_bounds_animation.h" 29 #include "chrome/browser/ui/panels/panel_bounds_animation.h"
30 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h" 30 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h"
31 #include "chrome/browser/ui/panels/panel_manager.h" 31 #include "chrome/browser/ui/panels/panel_manager.h"
32 #include "chrome/browser/ui/panels/panel_settings_menu_model.h" 32 #include "chrome/browser/ui/panels/panel_settings_menu_model.h"
33 #include "chrome/browser/ui/panels/panel_strip.h" 33 #include "chrome/browser/ui/panels/panel_strip.h"
34 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" 34 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h"
35 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 35 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
36 #include "chrome/common/chrome_notification_types.h" 36 #include "chrome/common/chrome_notification_types.h"
37 #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"
38 #include "content/public/browser/render_widget_host_view.h"
39 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
40 #include "grit/ui_resources.h" 40 #include "grit/ui_resources.h"
41 #include "ui/base/resource/resource_bundle.h" 41 #include "ui/base/resource/resource_bundle.h"
42 #include "ui/gfx/image/image.h" 42 #include "ui/gfx/image/image.h"
43 #include "ui/gfx/mac/nsimage_cache.h" 43 #include "ui/gfx/mac/nsimage_cache.h"
44 44
45 using content::WebContents; 45 using content::WebContents;
46 46
47 const int kMinimumWindowSize = 1; 47 const int kMinimumWindowSize = 1;
48 const double kBoundsAnimationSpeedPixelsPerSecond = 1000; 48 const double kBoundsAnimationSpeedPixelsPerSecond = 1000;
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 // TODO(dcheng): These two selectors are almost copy-and-paste from 553 // TODO(dcheng): These two selectors are almost copy-and-paste from
554 // BrowserWindowController. Figure out the appropriate way of code sharing, 554 // BrowserWindowController. Figure out the appropriate way of code sharing,
555 // whether it's refactoring more things into BrowserWindowUtils or making a 555 // whether it's refactoring more things into BrowserWindowUtils or making a
556 // common base controller for browser windows. 556 // common base controller for browser windows.
557 - (void)windowDidBecomeKey:(NSNotification*)notification { 557 - (void)windowDidBecomeKey:(NSNotification*)notification {
558 BrowserList::SetLastActive(windowShim_->browser()); 558 BrowserList::SetLastActive(windowShim_->browser());
559 559
560 // We need to activate the controls (in the "WebView"). To do this, get the 560 // We need to activate the controls (in the "WebView"). To do this, get the
561 // selected TabContents's RenderWidgetHostView and tell it to activate. 561 // selected TabContents's RenderWidgetHostView and tell it to activate.
562 if (WebContents* contents = [contentsController_ webContents]) { 562 if (WebContents* contents = [contentsController_ webContents]) {
563 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) 563 if (content::RenderWidgetHostView* rwhv =
564 contents->GetRenderWidgetHostView())
564 rwhv->SetActive(true); 565 rwhv->SetActive(true);
565 } 566 }
566 567
567 // If the window becomes key, lets make sure it is expanded and stop 568 // If the window becomes key, lets make sure it is expanded and stop
568 // drawing attention - since it is ready to accept input, it already has 569 // drawing attention - since it is ready to accept input, it already has
569 // user's attention. 570 // user's attention.
570 if ([[self titlebarView] isDrawingAttention]) { 571 if ([[self titlebarView] isDrawingAttention]) {
571 [[self titlebarView] stopDrawingAttention]; 572 [[self titlebarView] stopDrawingAttention];
572 } 573 }
573 574
574 content::NotificationService::current()->Notify( 575 content::NotificationService::current()->Notify(
575 chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS, 576 chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS,
576 content::Source<Panel>(windowShim_->panel()), 577 content::Source<Panel>(windowShim_->panel()),
577 content::NotificationService::NoDetails()); 578 content::NotificationService::NoDetails());
578 } 579 }
579 580
580 - (void)windowDidResignKey:(NSNotification*)notification { 581 - (void)windowDidResignKey:(NSNotification*)notification {
581 // If our app is still active and we're still the key window, ignore this 582 // If our app is still active and we're still the key window, ignore this
582 // message, since it just means that a menu extra (on the "system status bar") 583 // message, since it just means that a menu extra (on the "system status bar")
583 // was activated; we'll get another |-windowDidResignKey| if we ever really 584 // was activated; we'll get another |-windowDidResignKey| if we ever really
584 // lose key window status. 585 // lose key window status.
585 if ([NSApp isActive] && ([NSApp keyWindow] == [self window])) 586 if ([NSApp isActive] && ([NSApp keyWindow] == [self window]))
586 return; 587 return;
587 588
588 // We need to deactivate the controls (in the "WebView"). To do this, get the 589 // We need to deactivate the controls (in the "WebView"). To do this, get the
589 // selected TabContents's RenderWidgetHostView and tell it to deactivate. 590 // selected TabContents's RenderWidgetHostView and tell it to deactivate.
590 if (WebContents* contents = [contentsController_ webContents]) { 591 if (WebContents* contents = [contentsController_ webContents]) {
591 if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) 592 if (content::RenderWidgetHostView* rwhv =
593 contents->GetRenderWidgetHostView())
592 rwhv->SetActive(false); 594 rwhv->SetActive(false);
593 } 595 }
594 596
595 content::NotificationService::current()->Notify( 597 content::NotificationService::current()->Notify(
596 chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS, 598 chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS,
597 content::Source<Panel>(windowShim_->panel()), 599 content::Source<Panel>(windowShim_->panel()),
598 content::NotificationService::NoDetails()); 600 content::NotificationService::NoDetails());
599 } 601 }
600 602
601 - (void)deactivate { 603 - (void)deactivate {
(...skipping 16 matching lines...) Expand all
618 620
619 - (BOOL)canBecomeKeyWindow { 621 - (BOOL)canBecomeKeyWindow {
620 // Panel can only gain focus if it is expanded. Minimized panels do not 622 // Panel can only gain focus if it is expanded. Minimized panels do not
621 // participate in Cmd-~ rotation. 623 // participate in Cmd-~ rotation.
622 // TODO(dimich): If it will be ever desired to expand/focus the Panel on 624 // TODO(dimich): If it will be ever desired to expand/focus the Panel on
623 // keyboard navigation or via main menu, the care should be taken to avoid 625 // keyboard navigation or via main menu, the care should be taken to avoid
624 // cases when minimized Panel is getting keyboard input, invisibly. 626 // cases when minimized Panel is getting keyboard input, invisibly.
625 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; 627 return windowShim_->panel()->expansion_state() == Panel::EXPANDED;
626 } 628 }
627 @end 629 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/web_intent_picker_gtk.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698