| OLD | NEW |
| 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 #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" |
| (...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 - (void)bookmarkBubbleWindowWillClose:(NSNotification*)notification { | 1641 - (void)bookmarkBubbleWindowWillClose:(NSNotification*)notification { |
| 1642 DCHECK_EQ([notification object], [bookmarkBubbleController_ window]); | 1642 DCHECK_EQ([notification object], [bookmarkBubbleController_ window]); |
| 1643 | 1643 |
| 1644 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 1644 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 1645 [center removeObserver:self | 1645 [center removeObserver:self |
| 1646 name:NSWindowWillCloseNotification | 1646 name:NSWindowWillCloseNotification |
| 1647 object:[bookmarkBubbleController_ window]]; | 1647 object:[bookmarkBubbleController_ window]]; |
| 1648 bookmarkBubbleController_ = nil; | 1648 bookmarkBubbleController_ = nil; |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 - (NSPoint)chromeToMobileBubblePoint { | |
| 1652 return [toolbarController_ chromeToMobileBubblePoint]; | |
| 1653 } | |
| 1654 | |
| 1655 // Show the Chrome To Mobile bubble (e.g. user just clicked on the icon). | 1651 // Show the Chrome To Mobile bubble (e.g. user just clicked on the icon). |
| 1656 - (void)showChromeToMobileBubble { | 1652 - (void)showChromeToMobileBubble { |
| 1657 // Do nothing if the bubble is already showing. | 1653 // Do nothing if the bubble is already showing. |
| 1658 if (chromeToMobileBubbleController_) | 1654 if (chromeToMobileBubbleController_) |
| 1659 return; | 1655 return; |
| 1660 | 1656 |
| 1661 chromeToMobileBubbleController_ = | 1657 chromeToMobileBubbleController_ = |
| 1662 [[ChromeToMobileBubbleController alloc] | 1658 [[ChromeToMobileBubbleController alloc] |
| 1663 initWithParentWindow:[self window] | 1659 initWithParentWindow:[self window] |
| 1664 browser:browser_.get()]; | 1660 browser:browser_.get()]; |
| 1665 [chromeToMobileBubbleController_ showWindow:self]; | 1661 [chromeToMobileBubbleController_ showWindow:self]; |
| 1666 | |
| 1667 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | |
| 1668 [center addObserver:self | |
| 1669 selector:@selector(chromeToMobileBubbleWindowWillClose:) | |
| 1670 name:NSWindowWillCloseNotification | |
| 1671 object:[chromeToMobileBubbleController_ window]]; | |
| 1672 // Show the lit Chrome To Mobile icon while the bubble is visible. | |
| 1673 [self locationBarBridge]->SetChromeToMobileDecorationLit(true); | |
| 1674 } | 1662 } |
| 1675 | 1663 |
| 1676 // Nil out the weak Chrome To Mobile bubble controller reference. | 1664 // Nil out the weak Chrome To Mobile bubble controller reference. |
| 1677 - (void)chromeToMobileBubbleWindowWillClose:(NSNotification*)notification { | 1665 - (void)chromeToMobileBubbleWindowWillClose { |
| 1678 DCHECK_EQ([notification object], [chromeToMobileBubbleController_ window]); | |
| 1679 | |
| 1680 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | |
| 1681 [center removeObserver:self | |
| 1682 name:NSWindowWillCloseNotification | |
| 1683 object:[chromeToMobileBubbleController_ window]]; | |
| 1684 chromeToMobileBubbleController_ = nil; | 1666 chromeToMobileBubbleController_ = nil; |
| 1685 // Restore the dimmed Chrome To Mobile icon when the bubble closes. | |
| 1686 [self locationBarBridge]->SetChromeToMobileDecorationLit(false); | |
| 1687 } | 1667 } |
| 1688 | 1668 |
| 1689 // Handle the editBookmarkNode: action sent from bookmark bubble controllers. | 1669 // Handle the editBookmarkNode: action sent from bookmark bubble controllers. |
| 1690 - (void)editBookmarkNode:(id)sender { | 1670 - (void)editBookmarkNode:(id)sender { |
| 1691 BOOL responds = [sender respondsToSelector:@selector(node)]; | 1671 BOOL responds = [sender respondsToSelector:@selector(node)]; |
| 1692 DCHECK(responds); | 1672 DCHECK(responds); |
| 1693 if (responds) { | 1673 if (responds) { |
| 1694 const BookmarkNode* node = [sender node]; | 1674 const BookmarkNode* node = [sender node]; |
| 1695 if (node) | 1675 if (node) |
| 1696 BookmarkEditor::Show([self window], browser_->profile(), | 1676 BookmarkEditor::Show([self window], browser_->profile(), |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2217 | 2197 |
| 2218 - (BOOL)supportsBookmarkBar { | 2198 - (BOOL)supportsBookmarkBar { |
| 2219 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2199 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2220 } | 2200 } |
| 2221 | 2201 |
| 2222 - (BOOL)isTabbedWindow { | 2202 - (BOOL)isTabbedWindow { |
| 2223 return browser_->is_type_tabbed(); | 2203 return browser_->is_type_tabbed(); |
| 2224 } | 2204 } |
| 2225 | 2205 |
| 2226 @end // @implementation BrowserWindowController(WindowType) | 2206 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |