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

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

Issue 2142983002: Add desktop engagement metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « chrome/browser/ui/browser_list_observer.h ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <utility> 9 #include <utility>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" 51 #import "chrome/browser/ui/cocoa/dev_tools_controller.h"
52 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" 52 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h"
53 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h" 53 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa .h"
54 #import "chrome/browser/ui/cocoa/fast_resize_view.h" 54 #import "chrome/browser/ui/cocoa/fast_resize_view.h"
55 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" 55 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h"
56 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" 56 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h"
57 #import "chrome/browser/ui/cocoa/framed_browser_window.h" 57 #import "chrome/browser/ui/cocoa/framed_browser_window.h"
58 #include "chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.h" 58 #include "chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.h"
59 #import "chrome/browser/ui/cocoa/fullscreen_window.h" 59 #import "chrome/browser/ui/cocoa/fullscreen_window.h"
60 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" 60 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h"
61 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h"
62 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" 61 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
63 #import "chrome/browser/ui/cocoa/fullscreen_toolbar_controller.h" 62 #import "chrome/browser/ui/cocoa/fullscreen_toolbar_controller.h"
64 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h" 63 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h"
65 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h" 64 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h"
66 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" 65 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h"
67 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" 66 #import "chrome/browser/ui/cocoa/status_bubble_mac.h"
68 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" 67 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h"
69 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" 68 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
70 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 69 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
71 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 70 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 [[self window] orderOut:self]; 590 [[self window] orderOut:self];
592 return NO; 591 return NO;
593 } 592 }
594 593
595 // the tab strip is empty, it's ok to close the window 594 // the tab strip is empty, it's ok to close the window
596 return YES; 595 return YES;
597 } 596 }
598 597
599 // Called right after our window became the main window. 598 // Called right after our window became the main window.
600 - (void)windowDidBecomeMain:(NSNotification*)notification { 599 - (void)windowDidBecomeMain:(NSNotification*)notification {
601 if (chrome::GetLastActiveBrowser() != browser_.get()) { 600 // Set this window as active even if the previously active windows was the
602 BrowserList::SetLastActive(browser_.get()); 601 // same one. This is needed for tracking visibility changes of a browser.
603 } 602 BrowserList::SetLastActive(browser_.get());
603
604 // Always saveWindowPositionIfNeeded when becoming main, not just 604 // Always saveWindowPositionIfNeeded when becoming main, not just
605 // when |browser_| is not the last active browser. See crbug.com/536280 . 605 // when |browser_| is not the last active browser. See crbug.com/536280 .
606 [self saveWindowPositionIfNeeded]; 606 [self saveWindowPositionIfNeeded];
607 607
608 NSView* rootView = [[[self window] contentView] superview]; 608 NSView* rootView = [[[self window] contentView] superview];
609 [rootView cr_recursivelyInvokeBlock:^(id view) { 609 [rootView cr_recursivelyInvokeBlock:^(id view) {
610 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)]) 610 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)])
611 [view windowDidChangeActive]; 611 [view windowDidChangeActive];
612 }]; 612 }];
613 613
614 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()) 614 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile())
615 ->set_registry_for_active_window(extension_keybinding_registry_.get()); 615 ->set_registry_for_active_window(extension_keybinding_registry_.get());
616 } 616 }
617 617
618 - (void)windowDidResignMain:(NSNotification*)notification { 618 - (void)windowDidResignMain:(NSNotification*)notification {
619 NSView* rootView = [[[self window] contentView] superview]; 619 NSView* rootView = [[[self window] contentView] superview];
620 [rootView cr_recursivelyInvokeBlock:^(id view) { 620 [rootView cr_recursivelyInvokeBlock:^(id view) {
621 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)]) 621 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)])
622 [view windowDidChangeActive]; 622 [view windowDidChangeActive];
623 }]; 623 }];
624 624
625 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()) 625 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile())
626 ->set_registry_for_active_window(nullptr); 626 ->set_registry_for_active_window(nullptr);
627
628 BrowserList::NotifyBrowserNoLongerActive(browser_.get());
627 } 629 }
628 630
629 // Called when we have been minimized. 631 // Called when we have been minimized.
630 - (void)windowDidMiniaturize:(NSNotification *)notification { 632 - (void)windowDidMiniaturize:(NSNotification *)notification {
631 [self saveWindowPositionIfNeeded]; 633 [self saveWindowPositionIfNeeded];
632 } 634 }
633 635
634 // Called when we have been unminimized. 636 // Called when we have been unminimized.
635 - (void)windowDidDeminiaturize:(NSNotification *)notification { 637 - (void)windowDidDeminiaturize:(NSNotification *)notification {
636 // Make sure the window's show_state (which is now ui::SHOW_STATE_NORMAL) 638 // Make sure the window's show_state (which is now ui::SHOW_STATE_NORMAL)
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 2055
2054 - (NSRect)savedRegularWindowFrame { 2056 - (NSRect)savedRegularWindowFrame {
2055 return savedRegularWindowFrame_; 2057 return savedRegularWindowFrame_;
2056 } 2058 }
2057 2059
2058 - (BOOL)isFullscreenTransitionInProgress { 2060 - (BOOL)isFullscreenTransitionInProgress {
2059 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; 2061 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_;
2060 } 2062 }
2061 2063
2062 @end // @implementation BrowserWindowController(WindowType) 2064 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_list_observer.h ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698