OLD | NEW |
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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/logging.h" // for NOTREACHED() | 7 #include "base/logging.h" // for NOTREACHED() |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_commands.h" | 15 #include "chrome/browser/ui/browser_commands.h" |
16 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 16 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
17 #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h" | 17 #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h" |
18 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 18 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
19 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 19 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
20 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 20 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
21 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" | 21 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" |
22 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
23 #include "extensions/browser/extension_system.h" | 23 #include "extensions/browser/extension_registry.h" |
24 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" | 24 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" |
25 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT
weaker.h" | 25 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT
weaker.h" |
26 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 26 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
27 #include "ui/base/accelerators/platform_accelerator_cocoa.h" | 27 #include "ui/base/accelerators/platform_accelerator_cocoa.h" |
28 #import "ui/base/cocoa/controls/hyperlink_text_view.h" | 28 #import "ui/base/cocoa/controls/hyperlink_text_view.h" |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 #include "ui/base/l10n/l10n_util_mac.h" | 30 #include "ui/base/l10n/l10n_util_mac.h" |
31 #include "ui/strings/grit/ui_strings.h" | 31 #include "ui/strings/grit/ui_strings.h" |
32 | 32 |
33 | 33 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 textFrame.size.width = ceil(NSWidth(textFrame)); | 252 textFrame.size.width = ceil(NSWidth(textFrame)); |
253 labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame); | 253 labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame); |
254 labelFrame.size = textFrame.size; | 254 labelFrame.size = textFrame.size; |
255 [exitLabel_ setFrame:labelFrame]; | 255 [exitLabel_ setFrame:labelFrame]; |
256 } | 256 } |
257 | 257 |
258 - (NSString*)getLabelText { | 258 - (NSString*)getLabelText { |
259 if (bubbleType_ == FEB_TYPE_NONE) | 259 if (bubbleType_ == FEB_TYPE_NONE) |
260 return @""; | 260 return @""; |
261 ExtensionService* extension_service = extensions::ExtensionSystem::Get( | 261 extensions::ExtensionRegistry* registry = |
262 browser_->profile())->extension_service(); | 262 extensions::ExtensionRegistry::Get(browser_->profile()); |
263 return SysUTF16ToNSString(fullscreen_bubble::GetLabelTextForType( | 263 return SysUTF16ToNSString( |
264 bubbleType_, url_, extension_service)); | 264 fullscreen_bubble::GetLabelTextForType(bubbleType_, url_, registry)); |
265 } | 265 } |
266 | 266 |
267 // This looks at the Main Menu and determines what the user has set as the | 267 // This looks at the Main Menu and determines what the user has set as the |
268 // key combination for quit. It then gets the modifiers and builds an object | 268 // key combination for quit. It then gets the modifiers and builds an object |
269 // to hold the data. | 269 // to hold the data. |
270 + (scoped_ptr<ui::PlatformAcceleratorCocoa>)acceleratorForToggleFullscreen { | 270 + (scoped_ptr<ui::PlatformAcceleratorCocoa>)acceleratorForToggleFullscreen { |
271 NSMenu* mainMenu = [NSApp mainMenu]; | 271 NSMenu* mainMenu = [NSApp mainMenu]; |
272 // Get the application menu (i.e. Chromium). | 272 // Get the application menu (i.e. Chromium). |
273 for (NSMenuItem* menu in [mainMenu itemArray]) { | 273 for (NSMenuItem* menu in [mainMenu itemArray]) { |
274 for (NSMenuItem* item in [[menu submenu] itemArray]) { | 274 for (NSMenuItem* item in [[menu submenu] itemArray]) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 - (void)hideSoon { | 317 - (void)hideSoon { |
318 hideTimer_.reset( | 318 hideTimer_.reset( |
319 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay | 319 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay |
320 target:self | 320 target:self |
321 selector:@selector(hideTimerFired:) | 321 selector:@selector(hideTimerFired:) |
322 userInfo:nil | 322 userInfo:nil |
323 repeats:NO] retain]); | 323 repeats:NO] retain]); |
324 } | 324 } |
325 | 325 |
326 @end | 326 @end |
OLD | NEW |