| 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" | 20 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" |
| 21 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" | |
| 22 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/devtools/devtools_window.h" | 22 #include "chrome/browser/devtools/devtools_window.h" |
| 24 #include "chrome/browser/extensions/extension_commands_global_registry.h" | 23 #include "chrome/browser/extensions/extension_commands_global_registry.h" |
| 25 #include "chrome/browser/fullscreen.h" | 24 #include "chrome/browser/fullscreen.h" |
| 26 #include "chrome/browser/profiles/avatar_menu.h" | 25 #include "chrome/browser/profiles/avatar_menu.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/profiles/profile_info_cache.h" | 27 #include "chrome/browser/profiles/profile_info_cache.h" |
| 29 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
| 30 #include "chrome/browser/profiles/profiles_state.h" | 29 #include "chrome/browser/profiles/profiles_state.h" |
| 31 #include "chrome/browser/themes/theme_service.h" | 30 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 76 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
| 78 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" | 77 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" |
| 79 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 78 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
| 80 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 79 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 81 #include "chrome/common/chrome_switches.h" | 80 #include "chrome/common/chrome_switches.h" |
| 82 #include "chrome/common/extensions/command.h" | 81 #include "chrome/common/extensions/command.h" |
| 83 #include "chrome/common/url_constants.h" | 82 #include "chrome/common/url_constants.h" |
| 84 #include "chrome/grit/generated_resources.h" | 83 #include "chrome/grit/generated_resources.h" |
| 85 #include "chrome/grit/locale_settings.h" | 84 #include "chrome/grit/locale_settings.h" |
| 86 #include "components/bookmarks/browser/bookmark_model.h" | 85 #include "components/bookmarks/browser/bookmark_model.h" |
| 86 #include "components/bookmarks/managed/managed_bookmark_service.h" |
| 87 #include "components/signin/core/common/profile_management_switches.h" | 87 #include "components/signin/core/common/profile_management_switches.h" |
| 88 #include "components/translate/core/browser/translate_manager.h" | 88 #include "components/translate/core/browser/translate_manager.h" |
| 89 #include "components/translate/core/browser/translate_ui_delegate.h" | 89 #include "components/translate/core/browser/translate_ui_delegate.h" |
| 90 #include "components/web_modal/popup_manager.h" | 90 #include "components/web_modal/popup_manager.h" |
| 91 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 91 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 92 #include "content/public/browser/render_view_host.h" | 92 #include "content/public/browser/render_view_host.h" |
| 93 #include "content/public/browser/render_widget_host_view.h" | 93 #include "content/public/browser/render_widget_host_view.h" |
| 94 #include "content/public/browser/web_contents.h" | 94 #include "content/public/browser/web_contents.h" |
| 95 #import "ui/base/cocoa/cocoa_base_utils.h" | 95 #import "ui/base/cocoa/cocoa_base_utils.h" |
| 96 #import "ui/base/cocoa/nsview_additions.h" | 96 #import "ui/base/cocoa/nsview_additions.h" |
| (...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1768 - (NSPoint)bookmarkBubblePoint { | 1768 - (NSPoint)bookmarkBubblePoint { |
| 1769 return [toolbarController_ bookmarkBubblePoint]; | 1769 return [toolbarController_ bookmarkBubblePoint]; |
| 1770 } | 1770 } |
| 1771 | 1771 |
| 1772 // Show the bookmark bubble (e.g. user just clicked on the STAR). | 1772 // Show the bookmark bubble (e.g. user just clicked on the STAR). |
| 1773 - (void)showBookmarkBubbleForURL:(const GURL&)url | 1773 - (void)showBookmarkBubbleForURL:(const GURL&)url |
| 1774 alreadyBookmarked:(BOOL)alreadyMarked { | 1774 alreadyBookmarked:(BOOL)alreadyMarked { |
| 1775 if (!bookmarkBubbleController_) { | 1775 if (!bookmarkBubbleController_) { |
| 1776 BookmarkModel* model = | 1776 BookmarkModel* model = |
| 1777 BookmarkModelFactory::GetForProfile(browser_->profile()); | 1777 BookmarkModelFactory::GetForProfile(browser_->profile()); |
| 1778 ChromeBookmarkClient* client = | 1778 bookmarks::ManagedBookmarkService* managed = |
| 1779 ChromeBookmarkClientFactory::GetForProfile(browser_->profile()); | 1779 ManagedBookmarkServiceFactory::GetForProfile(browser_->profile()); |
| 1780 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url); | 1780 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url); |
| 1781 bookmarkBubbleController_ = | 1781 bookmarkBubbleController_ = |
| 1782 [[BookmarkBubbleController alloc] initWithParentWindow:[self window] | 1782 [[BookmarkBubbleController alloc] initWithParentWindow:[self window] |
| 1783 client:client | 1783 managed:managed |
| 1784 model:model | 1784 model:model |
| 1785 node:node | 1785 node:node |
| 1786 alreadyBookmarked:alreadyMarked]; | 1786 alreadyBookmarked:alreadyMarked]; |
| 1787 [bookmarkBubbleController_ showWindow:self]; | 1787 [bookmarkBubbleController_ showWindow:self]; |
| 1788 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 1788 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 1789 [center addObserver:self | 1789 [center addObserver:self |
| 1790 selector:@selector(bookmarkBubbleWindowWillClose:) | 1790 selector:@selector(bookmarkBubbleWindowWillClose:) |
| 1791 name:NSWindowWillCloseNotification | 1791 name:NSWindowWillCloseNotification |
| 1792 object:[bookmarkBubbleController_ window]]; | 1792 object:[bookmarkBubbleController_ window]]; |
| 1793 } | 1793 } |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2272 | 2272 |
| 2273 - (BOOL)supportsBookmarkBar { | 2273 - (BOOL)supportsBookmarkBar { |
| 2274 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2274 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2275 } | 2275 } |
| 2276 | 2276 |
| 2277 - (BOOL)isTabbedWindow { | 2277 - (BOOL)isTabbedWindow { |
| 2278 return browser_->is_type_tabbed(); | 2278 return browser_->is_type_tabbed(); |
| 2279 } | 2279 } |
| 2280 | 2280 |
| 2281 @end // @implementation BrowserWindowController(WindowType) | 2281 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |