OLD | NEW |
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 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.h" |
12 #import "base/mac/foundation_util.h" | 12 #import "base/mac/foundation_util.h" |
13 #include "base/mac/mac_util.h" | 13 #include "base/mac/mac_util.h" |
14 #import "base/mac/sdk_forward_declarations.h" | 14 #import "base/mac/sdk_forward_declarations.h" |
15 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "chrome/app/chrome_command_ids.h" // IDC_* | 17 #include "chrome/app/chrome_command_ids.h" // IDC_* |
18 #import "chrome/browser/app_controller_mac.h" | 18 #import "chrome/browser/app_controller_mac.h" |
19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
20 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | |
21 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" | |
22 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/devtools/devtools_window.h" | 21 #include "chrome/browser/devtools/devtools_window.h" |
24 #include "chrome/browser/extensions/extension_commands_global_registry.h" | 22 #include "chrome/browser/extensions/extension_commands_global_registry.h" |
25 #include "chrome/browser/fullscreen.h" | 23 #include "chrome/browser/fullscreen.h" |
26 #include "chrome/browser/profiles/avatar_menu.h" | 24 #include "chrome/browser/profiles/avatar_menu.h" |
27 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/browser/profiles/profile_info_cache.h" | 26 #include "chrome/browser/profiles/profile_info_cache.h" |
29 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.h" |
30 #include "chrome/browser/profiles/profiles_state.h" | 28 #include "chrome/browser/profiles/profiles_state.h" |
31 #include "chrome/browser/themes/theme_service.h" | 29 #include "chrome/browser/themes/theme_service.h" |
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 - (NSPoint)bookmarkBubblePoint { | 1764 - (NSPoint)bookmarkBubblePoint { |
1767 return [toolbarController_ bookmarkBubblePoint]; | 1765 return [toolbarController_ bookmarkBubblePoint]; |
1768 } | 1766 } |
1769 | 1767 |
1770 // Show the bookmark bubble (e.g. user just clicked on the STAR). | 1768 // Show the bookmark bubble (e.g. user just clicked on the STAR). |
1771 - (void)showBookmarkBubbleForURL:(const GURL&)url | 1769 - (void)showBookmarkBubbleForURL:(const GURL&)url |
1772 alreadyBookmarked:(BOOL)alreadyMarked { | 1770 alreadyBookmarked:(BOOL)alreadyMarked { |
1773 if (!bookmarkBubbleController_) { | 1771 if (!bookmarkBubbleController_) { |
1774 BookmarkModel* model = | 1772 BookmarkModel* model = |
1775 BookmarkModelFactory::GetForProfile(browser_->profile()); | 1773 BookmarkModelFactory::GetForProfile(browser_->profile()); |
1776 ChromeBookmarkClient* client = | |
1777 ChromeBookmarkClientFactory::GetForProfile(browser_->profile()); | |
1778 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url); | 1774 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url); |
1779 bookmarkBubbleController_ = | 1775 bookmarkBubbleController_ = |
1780 [[BookmarkBubbleController alloc] initWithParentWindow:[self window] | 1776 [[BookmarkBubbleController alloc] initWithParentWindow:[self window] |
1781 client:client | |
1782 model:model | 1777 model:model |
1783 node:node | 1778 node:node |
1784 alreadyBookmarked:alreadyMarked]; | 1779 alreadyBookmarked:alreadyMarked]; |
1785 [bookmarkBubbleController_ showWindow:self]; | 1780 [bookmarkBubbleController_ showWindow:self]; |
1786 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 1781 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
1787 [center addObserver:self | 1782 [center addObserver:self |
1788 selector:@selector(bookmarkBubbleWindowWillClose:) | 1783 selector:@selector(bookmarkBubbleWindowWillClose:) |
1789 name:NSWindowWillCloseNotification | 1784 name:NSWindowWillCloseNotification |
1790 object:[bookmarkBubbleController_ window]]; | 1785 object:[bookmarkBubbleController_ window]]; |
1791 } | 1786 } |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2265 | 2260 |
2266 - (BOOL)supportsBookmarkBar { | 2261 - (BOOL)supportsBookmarkBar { |
2267 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2262 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2268 } | 2263 } |
2269 | 2264 |
2270 - (BOOL)isTabbedWindow { | 2265 - (BOOL)isTabbedWindow { |
2271 return browser_->is_type_tabbed(); | 2266 return browser_->is_type_tabbed(); |
2272 } | 2267 } |
2273 | 2268 |
2274 @end // @implementation BrowserWindowController(WindowType) | 2269 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |