| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 content::NotificationRegistrar registrar_; | 36 content::NotificationRegistrar registrar_; |
| 37 BookmarkBubbleController* controller_; // weak; owns us. | 37 BookmarkBubbleController* controller_; // weak; owns us. |
| 38 SEL selector_; // SEL sent to controller_ on notification. | 38 SEL selector_; // SEL sent to controller_ on notification. |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 BookmarkBubbleNotificationBridge::BookmarkBubbleNotificationBridge( | 41 BookmarkBubbleNotificationBridge::BookmarkBubbleNotificationBridge( |
| 42 BookmarkBubbleController* controller, SEL selector) | 42 BookmarkBubbleController* controller, SEL selector) |
| 43 : controller_(controller), selector_(selector) { | 43 : controller_(controller), selector_(selector) { |
| 44 // registrar_ will automatically RemoveAll() when destroyed so we | 44 // registrar_ will automatically RemoveAll() when destroyed so we |
| 45 // don't need to do so explicitly. | 45 // don't need to do so explicitly. |
| 46 registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED, | 46 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, |
| 47 content::NotificationService::AllSources()); | 47 content::NotificationService::AllSources()); |
| 48 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, | 48 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, |
| 49 content::NotificationService::AllSources()); | 49 content::NotificationService::AllSources()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // At this time all notifications instigate the same behavior (go | 52 // At this time all notifications instigate the same behavior (go |
| 53 // away) so we don't bother checking which notification came in. | 53 // away) so we don't bother checking which notification came in. |
| 54 void BookmarkBubbleNotificationBridge::Observe( | 54 void BookmarkBubbleNotificationBridge::Observe( |
| 55 int type, | 55 int type, |
| 56 const content::NotificationSource& source, | 56 const content::NotificationSource& source, |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; | 427 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; |
| 428 DCHECK(idx != -1); | 428 DCHECK(idx != -1); |
| 429 [folderPopUpButton_ selectItemAtIndex:idx]; | 429 [folderPopUpButton_ selectItemAtIndex:idx]; |
| 430 } | 430 } |
| 431 | 431 |
| 432 - (NSPopUpButton*)folderPopUpButton { | 432 - (NSPopUpButton*)folderPopUpButton { |
| 433 return folderPopUpButton_; | 433 return folderPopUpButton_; |
| 434 } | 434 } |
| 435 | 435 |
| 436 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) | 436 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) |
| OLD | NEW |