| 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/hyperlink_text_view.h" | 18 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" |
| 19 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 19 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 20 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 20 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 21 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 21 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 22 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" | 22 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" |
| 23 #include "extensions/browser/extension_system.h" |
| 23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 24 #include "grit/ui_strings.h" | 25 #include "grit/ui_strings.h" |
| 25 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" | 26 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" |
| 26 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT
weaker.h" | 27 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT
weaker.h" |
| 27 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 28 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
| 28 #include "ui/base/accelerators/platform_accelerator_cocoa.h" | 29 #include "ui/base/accelerators/platform_accelerator_cocoa.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/base/l10n/l10n_util_mac.h" | 31 #include "ui/base/l10n/l10n_util_mac.h" |
| 31 | 32 |
| 32 | 33 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 251 |
| 251 textFrame.size.width = ceil(NSWidth(textFrame)); | 252 textFrame.size.width = ceil(NSWidth(textFrame)); |
| 252 labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame); | 253 labelFrame.origin.x += NSWidth(labelFrame) - NSWidth(textFrame); |
| 253 labelFrame.size = textFrame.size; | 254 labelFrame.size = textFrame.size; |
| 254 [exitLabel_ setFrame:labelFrame]; | 255 [exitLabel_ setFrame:labelFrame]; |
| 255 } | 256 } |
| 256 | 257 |
| 257 - (NSString*)getLabelText { | 258 - (NSString*)getLabelText { |
| 258 if (bubbleType_ == FEB_TYPE_NONE) | 259 if (bubbleType_ == FEB_TYPE_NONE) |
| 259 return @""; | 260 return @""; |
| 261 ExtensionService* extension_service = extensions::ExtensionSystem::Get( |
| 262 browser_->profile())->extension_service(); |
| 260 return SysUTF16ToNSString(fullscreen_bubble::GetLabelTextForType( | 263 return SysUTF16ToNSString(fullscreen_bubble::GetLabelTextForType( |
| 261 bubbleType_, url_, browser_->profile()->GetExtensionService())); | 264 bubbleType_, url_, extension_service)); |
| 262 } | 265 } |
| 263 | 266 |
| 264 // 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 |
| 265 // 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 |
| 266 // to hold the data. | 269 // to hold the data. |
| 267 + (scoped_ptr<ui::PlatformAcceleratorCocoa>)acceleratorForToggleFullscreen { | 270 + (scoped_ptr<ui::PlatformAcceleratorCocoa>)acceleratorForToggleFullscreen { |
| 268 NSMenu* mainMenu = [NSApp mainMenu]; | 271 NSMenu* mainMenu = [NSApp mainMenu]; |
| 269 // Get the application menu (i.e. Chromium). | 272 // Get the application menu (i.e. Chromium). |
| 270 for (NSMenuItem* menu in [mainMenu itemArray]) { | 273 for (NSMenuItem* menu in [mainMenu itemArray]) { |
| 271 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... |
| 314 - (void)hideSoon { | 317 - (void)hideSoon { |
| 315 hideTimer_.reset( | 318 hideTimer_.reset( |
| 316 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay | 319 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay |
| 317 target:self | 320 target:self |
| 318 selector:@selector(hideTimerFired:) | 321 selector:@selector(hideTimerFired:) |
| 319 userInfo:nil | 322 userInfo:nil |
| 320 repeats:NO] retain]); | 323 repeats:NO] retain]); |
| 321 } | 324 } |
| 322 | 325 |
| 323 @end | 326 @end |
| OLD | NEW |