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

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

Issue 306293006: Introduce ChromeBookmarkClientFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@364865
Patch Set: Rebase, remove BookmarkModelFactory::GetChromeBookmarkClientForProfile and fix unit tests Created 6 years, 6 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
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 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 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
19 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" 19 #include "chrome/browser/bookmarks/chrome_bookmark_client.h"
20 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h"
20 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/devtools/devtools_window.h" 22 #include "chrome/browser/devtools/devtools_window.h"
22 #include "chrome/browser/fullscreen.h" 23 #include "chrome/browser/fullscreen.h"
23 #include "chrome/browser/profiles/avatar_menu.h" 24 #include "chrome/browser/profiles/avatar_menu.h"
24 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/profiles/profile_info_cache.h" 26 #include "chrome/browser/profiles/profile_info_cache.h"
26 #include "chrome/browser/profiles/profile_manager.h" 27 #include "chrome/browser/profiles/profile_manager.h"
27 #include "chrome/browser/profiles/profiles_state.h" 28 #include "chrome/browser/profiles/profiles_state.h"
28 #include "chrome/browser/signin/signin_ui_util.h" 29 #include "chrome/browser/signin/signin_ui_util.h"
29 #include "chrome/browser/themes/theme_service.h" 30 #include "chrome/browser/themes/theme_service.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "chrome/browser/ui/omnibox/location_bar.h" 73 #include "chrome/browser/ui/omnibox/location_bar.h"
73 #include "chrome/browser/ui/tabs/tab_strip_model.h" 74 #include "chrome/browser/ui/tabs/tab_strip_model.h"
74 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" 75 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
75 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 76 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
76 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" 77 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h"
77 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 78 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
78 #include "chrome/browser/ui/window_sizer/window_sizer.h" 79 #include "chrome/browser/ui/window_sizer/window_sizer.h"
79 #include "chrome/common/chrome_switches.h" 80 #include "chrome/common/chrome_switches.h"
80 #include "chrome/common/extensions/command.h" 81 #include "chrome/common/extensions/command.h"
81 #include "chrome/common/url_constants.h" 82 #include "chrome/common/url_constants.h"
83 #include "components/bookmarks/browser/bookmark_model.h"
82 #include "components/signin/core/common/profile_management_switches.h" 84 #include "components/signin/core/common/profile_management_switches.h"
83 #include "components/translate/core/browser/translate_manager.h" 85 #include "components/translate/core/browser/translate_manager.h"
84 #include "components/translate/core/browser/translate_ui_delegate.h" 86 #include "components/translate/core/browser/translate_ui_delegate.h"
85 #include "components/web_modal/web_contents_modal_dialog_manager.h" 87 #include "components/web_modal/web_contents_modal_dialog_manager.h"
86 #include "content/public/browser/render_view_host.h" 88 #include "content/public/browser/render_view_host.h"
87 #include "content/public/browser/render_widget_host_view.h" 89 #include "content/public/browser/render_widget_host_view.h"
88 #include "content/public/browser/web_contents.h" 90 #include "content/public/browser/web_contents.h"
89 #include "grit/chromium_strings.h" 91 #include "grit/chromium_strings.h"
90 #include "grit/generated_resources.h" 92 #include "grit/generated_resources.h"
91 #include "grit/locale_settings.h" 93 #include "grit/locale_settings.h"
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 } 1696 }
1695 1697
1696 - (NSPoint)bookmarkBubblePoint { 1698 - (NSPoint)bookmarkBubblePoint {
1697 return [toolbarController_ bookmarkBubblePoint]; 1699 return [toolbarController_ bookmarkBubblePoint];
1698 } 1700 }
1699 1701
1700 // Show the bookmark bubble (e.g. user just clicked on the STAR). 1702 // Show the bookmark bubble (e.g. user just clicked on the STAR).
1701 - (void)showBookmarkBubbleForURL:(const GURL&)url 1703 - (void)showBookmarkBubbleForURL:(const GURL&)url
1702 alreadyBookmarked:(BOOL)alreadyMarked { 1704 alreadyBookmarked:(BOOL)alreadyMarked {
1703 if (!bookmarkBubbleController_) { 1705 if (!bookmarkBubbleController_) {
1706 BookmarkModel* model =
1707 BookmarkModelFactory::GetForProfile(browser_->profile());
1704 ChromeBookmarkClient* client = 1708 ChromeBookmarkClient* client =
1705 BookmarkModelFactory::GetChromeBookmarkClientForProfile( 1709 ChromeBookmarkClientFactory::GetForProfile(browser_->profile());
1706 browser_->profile()); 1710 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url);
1707 const BookmarkNode* node =
1708 client->model()->GetMostRecentlyAddedUserNodeForURL(url);
1709 bookmarkBubbleController_ = 1711 bookmarkBubbleController_ =
1710 [[BookmarkBubbleController alloc] initWithParentWindow:[self window] 1712 [[BookmarkBubbleController alloc] initWithParentWindow:[self window]
1711 client:client 1713 client:client
1714 model:model
1712 node:node 1715 node:node
1713 alreadyBookmarked:alreadyMarked]; 1716 alreadyBookmarked:alreadyMarked];
1714 [bookmarkBubbleController_ showWindow:self]; 1717 [bookmarkBubbleController_ showWindow:self];
1715 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 1718 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
1716 [center addObserver:self 1719 [center addObserver:self
1717 selector:@selector(bookmarkBubbleWindowWillClose:) 1720 selector:@selector(bookmarkBubbleWindowWillClose:)
1718 name:NSWindowWillCloseNotification 1721 name:NSWindowWillCloseNotification
1719 object:[bookmarkBubbleController_ window]]; 1722 object:[bookmarkBubbleController_ window]];
1720 } 1723 }
1721 } 1724 }
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 2289
2287 - (BOOL)supportsBookmarkBar { 2290 - (BOOL)supportsBookmarkBar {
2288 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2291 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2289 } 2292 }
2290 2293
2291 - (BOOL)isTabbedWindow { 2294 - (BOOL)isTabbedWindow {
2292 return browser_->is_type_tabbed(); 2295 return browser_->is_type_tabbed();
2293 } 2296 }
2294 2297
2295 @end // @implementation BrowserWindowController(WindowType) 2298 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698