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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm

Issue 2542173002: [Mac] Omnibox icons active states (Closed)
Patch Set: Created 4 years 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 (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/bookmarks/bookmark_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h" 9 #include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_finder.h" 11 #include "chrome/browser/ui/browser_finder.h"
12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
14 #import "chrome/browser/ui/cocoa/bubble_sync_promo_controller.h" 14 #import "chrome/browser/ui/cocoa/bubble_sync_promo_controller.h"
15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
16 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
17 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h"
16 #include "chrome/browser/ui/sync/sync_promo_ui.h" 18 #include "chrome/browser/ui/sync/sync_promo_ui.h"
17 #include "chrome/grit/chromium_strings.h" 19 #include "chrome/grit/chromium_strings.h"
18 #include "chrome/grit/generated_resources.h" 20 #include "chrome/grit/generated_resources.h"
19 #include "components/bookmarks/browser/bookmark_model.h" 21 #include "components/bookmarks/browser/bookmark_model.h"
20 #include "components/bookmarks/browser/bookmark_utils.h" 22 #include "components/bookmarks/browser/bookmark_utils.h"
21 #include "components/bookmarks/managed/managed_bookmark_service.h" 23 #include "components/bookmarks/managed/managed_bookmark_service.h"
22 #include "components/signin/core/browser/signin_metrics.h" 24 #include "components/signin/core/browser/signin_metrics.h"
23 #include "content/public/browser/notification_observer.h" 25 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_registrar.h" 26 #include "content/public/browser/notification_registrar.h"
25 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 bookmarkObserver_.reset(new BookmarkModelObserverForCocoa(model_, ^() { 174 bookmarkObserver_.reset(new BookmarkModelObserverForCocoa(model_, ^() {
173 [self dismissWithoutEditing:nil]; 175 [self dismissWithoutEditing:nil];
174 })); 176 }));
175 bookmarkObserver_->StartObservingNode(node_); 177 bookmarkObserver_->StartObservingNode(node_);
176 178
177 [parentWindow addChildWindow:window ordered:NSWindowAbove]; 179 [parentWindow addChildWindow:window ordered:NSWindowAbove];
178 [window makeKeyAndOrderFront:self]; 180 [window makeKeyAndOrderFront:self];
179 [self registerKeyStateEventTap]; 181 [self registerKeyStateEventTap];
180 182
181 bookmarkBubbleObserver_->OnBookmarkBubbleShown(node_); 183 bookmarkBubbleObserver_->OnBookmarkBubbleShown(node_);
184
185 [self decorationForBubble]->SetActive(true);
182 } 186 }
183 187
184 - (void)close { 188 - (void)close {
185 [[BrowserWindowController browserWindowControllerForWindow:self.parentWindow] 189 [[BrowserWindowController browserWindowControllerForWindow:self.parentWindow]
186 releaseToolbarVisibilityForOwner:self 190 releaseToolbarVisibilityForOwner:self
187 withAnimation:YES]; 191 withAnimation:YES];
188 192
189 [super close]; 193 [super close];
190 } 194 }
191 195
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 NSMenuItem *item = [menu addItemWithTitle:title 304 NSMenuItem *item = [menu addItemWithTitle:title
301 action:NULL 305 action:NULL
302 keyEquivalent:@""]; 306 keyEquivalent:@""];
303 [item setRepresentedObject:[[self class] chooseAnotherFolderObject]]; 307 [item setRepresentedObject:[[self class] chooseAnotherFolderObject]];
304 // Finally, select the current parent. 308 // Finally, select the current parent.
305 NSValue* parentValue = [NSValue valueWithPointer:node_->parent()]; 309 NSValue* parentValue = [NSValue valueWithPointer:node_->parent()];
306 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; 310 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue];
307 [folderPopUpButton_ selectItemAtIndex:idx]; 311 [folderPopUpButton_ selectItemAtIndex:idx];
308 } 312 }
309 313
314 - (LocationBarDecoration*)decorationForBubble {
315 LocationBarViewMac* locationBar =
316 [[[self parentWindow] windowController] locationBarBridge];
317 return locationBar ? locationBar->star_decoration() : nullptr;
318 }
319
310 @end // BookmarkBubbleController 320 @end // BookmarkBubbleController
311 321
312 322
313 @implementation BookmarkBubbleController (ExposedForUnitTesting) 323 @implementation BookmarkBubbleController (ExposedForUnitTesting)
314 324
315 - (NSView*)syncPromoPlaceholder { 325 - (NSView*)syncPromoPlaceholder {
316 return syncPromoPlaceholder_; 326 return syncPromoPlaceholder_;
317 } 327 }
318 328
319 - (bookmarks::BookmarkBubbleObserver*)bookmarkBubbleObserver { 329 - (bookmarks::BookmarkBubbleObserver*)bookmarkBubbleObserver {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; 376 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue];
367 DCHECK(idx != -1); 377 DCHECK(idx != -1);
368 [folderPopUpButton_ selectItemAtIndex:idx]; 378 [folderPopUpButton_ selectItemAtIndex:idx];
369 } 379 }
370 380
371 - (NSPopUpButton*)folderPopUpButton { 381 - (NSPopUpButton*)folderPopUpButton {
372 return folderPopUpButton_; 382 return folderPopUpButton_;
373 } 383 }
374 384
375 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) 385 @end // implementation BookmarkBubbleController(ExposedForUnitTesting)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698