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

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

Issue 10880064: Make extension commands grant the activeTab permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 years, 3 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 | Annotate | Revision Log
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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/sys_string_conversions.h" 12 #include "base/sys_string_conversions.h"
13 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
14 #include "chrome/browser/bookmarks/bookmark_utils.h" 14 #include "chrome/browser/bookmarks/bookmark_utils.h"
15 #include "chrome/browser/download/download_shelf.h" 15 #include "chrome/browser/download/download_shelf.h"
16 #include "chrome/browser/extensions/tab_helper.h"
16 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_command_controller.h" 20 #include "chrome/browser/ui/browser_command_controller.h"
20 #include "chrome/browser/ui/browser_commands.h" 21 #include "chrome/browser/ui/browser_commands.h"
21 #include "chrome/browser/ui/browser_list.h" 22 #include "chrome/browser/ui/browser_list.h"
22 #include "chrome/browser/ui/browser_tabstrip.h" 23 #include "chrome/browser/ui/browser_tabstrip.h"
23 #include "chrome/browser/ui/browser_window_state.h" 24 #include "chrome/browser/ui/browser_window_state.h"
24 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" 25 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h"
25 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h" 26 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h"
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 DCHECK(pref_name == prefs::kShowBookmarkBar); 613 DCHECK(pref_name == prefs::kShowBookmarkBar);
613 [controller_ updateBookmarkBarVisibilityWithAnimation:YES]; 614 [controller_ updateBookmarkBarVisibilityWithAnimation:YES];
614 break; 615 break;
615 } 616 }
616 default: 617 default:
617 NOTREACHED(); // we don't ask for anything else! 618 NOTREACHED(); // we don't ask for anything else!
618 break; 619 break;
619 } 620 }
620 } 621 }
621 622
623 extensions::ActiveTabPermissionGranter*
624 BrowserWindowCocoa::GetActiveTabPermissionGranter() {
625 TabContents* tab_contents =
626 browser_->tab_strip_model()->GetActiveTabContents();
627 if (!tab_contents)
628 return NULL;
629 extensions::TabHelper* tab_helper =
630 extensions::TabHelper::FromWebContents(tab_contents->web_contents());
631 return tab_helper ? tab_helper->active_tab_permission_granter() : NULL;
632 }
633
622 void BrowserWindowCocoa::DestroyBrowser() { 634 void BrowserWindowCocoa::DestroyBrowser() {
623 [controller_ destroyBrowser]; 635 [controller_ destroyBrowser];
624 636
625 // at this point the controller is dead (autoreleased), so 637 // at this point the controller is dead (autoreleased), so
626 // make sure we don't try to reference it any more. 638 // make sure we don't try to reference it any more.
627 } 639 }
628 640
629 NSWindow* BrowserWindowCocoa::window() const { 641 NSWindow* BrowserWindowCocoa::window() const {
630 return [controller_ window]; 642 return [controller_ window];
631 } 643 }
(...skipping 13 matching lines...) Expand all
645 AvatarMenuBubbleController* menu = 657 AvatarMenuBubbleController* menu =
646 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ 658 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_
647 anchoredAt:point]; 659 anchoredAt:point];
648 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; 660 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge];
649 [menu showWindow:nil]; 661 [menu showWindow:nil];
650 } 662 }
651 663
652 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { 664 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() {
653 [[controller_ avatarButtonController] showAvatarBubble]; 665 [[controller_ avatarButtonController] showAvatarBubble];
654 } 666 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.h ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698