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" |
11 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.h" |
12 #include "base/mac/mac_util.h" | 12 #include "base/mac/mac_util.h" |
13 #import "base/memory/scoped_nsobject.h" | 13 #import "base/memory/scoped_nsobject.h" |
14 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
15 #include "chrome/app/chrome_command_ids.h" // IDC_* | 15 #include "chrome/app/chrome_command_ids.h" // IDC_* |
16 #include "chrome/browser/bookmarks/bookmark_editor.h" | 16 #include "chrome/browser/bookmarks/bookmark_editor.h" |
| 17 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
17 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/instant/instant_controller.h" | 19 #include "chrome/browser/instant/instant_controller.h" |
19 #include "chrome/browser/managed_mode.h" | 20 #include "chrome/browser/managed_mode.h" |
20 #include "chrome/browser/profiles/avatar_menu_model.h" | 21 #include "chrome/browser/profiles/avatar_menu_model.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/profiles/profile_info_cache.h" | 23 #include "chrome/browser/profiles/profile_info_cache.h" |
23 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
24 #include "chrome/browser/sync/profile_sync_service.h" | 25 #include "chrome/browser/sync/profile_sync_service.h" |
25 #include "chrome/browser/sync/sync_ui_util_mac.h" | 26 #include "chrome/browser/sync/sync_ui_util_mac.h" |
26 #include "chrome/browser/themes/theme_service.h" | 27 #include "chrome/browser/themes/theme_service.h" |
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 } | 1597 } |
1597 | 1598 |
1598 - (NSPoint)bookmarkBubblePoint { | 1599 - (NSPoint)bookmarkBubblePoint { |
1599 return [toolbarController_ bookmarkBubblePoint]; | 1600 return [toolbarController_ bookmarkBubblePoint]; |
1600 } | 1601 } |
1601 | 1602 |
1602 // Show the bookmark bubble (e.g. user just clicked on the STAR). | 1603 // Show the bookmark bubble (e.g. user just clicked on the STAR). |
1603 - (void)showBookmarkBubbleForURL:(const GURL&)url | 1604 - (void)showBookmarkBubbleForURL:(const GURL&)url |
1604 alreadyBookmarked:(BOOL)alreadyMarked { | 1605 alreadyBookmarked:(BOOL)alreadyMarked { |
1605 if (!bookmarkBubbleController_) { | 1606 if (!bookmarkBubbleController_) { |
1606 BookmarkModel* model = browser_->profile()->GetBookmarkModel(); | 1607 BookmarkModel* model = |
| 1608 BookmarkModelFactory::GetForProfile(browser_->profile()); |
1607 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url); | 1609 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url); |
1608 bookmarkBubbleController_ = | 1610 bookmarkBubbleController_ = |
1609 [[BookmarkBubbleController alloc] initWithParentWindow:[self window] | 1611 [[BookmarkBubbleController alloc] initWithParentWindow:[self window] |
1610 model:model | 1612 model:model |
1611 node:node | 1613 node:node |
1612 alreadyBookmarked:alreadyMarked]; | 1614 alreadyBookmarked:alreadyMarked]; |
1613 [bookmarkBubbleController_ showWindow:self]; | 1615 [bookmarkBubbleController_ showWindow:self]; |
1614 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 1616 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
1615 [center addObserver:self | 1617 [center addObserver:self |
1616 selector:@selector(bookmarkBubbleWindowWillClose:) | 1618 selector:@selector(bookmarkBubbleWindowWillClose:) |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 | 2204 |
2203 - (BOOL)supportsBookmarkBar { | 2205 - (BOOL)supportsBookmarkBar { |
2204 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2206 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2205 } | 2207 } |
2206 | 2208 |
2207 - (BOOL)isTabbedWindow { | 2209 - (BOOL)isTabbedWindow { |
2208 return browser_->is_type_tabbed(); | 2210 return browser_->is_type_tabbed(); |
2209 } | 2211 } |
2210 | 2212 |
2211 @end // @implementation BrowserWindowController(WindowType) | 2213 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |