| 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/tabpose_window.h" | 5 #import "chrome/browser/ui/cocoa/tabpose_window.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/mac/mac_util.h" | 11 #include "base/mac/mac_util.h" |
| 12 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
| 13 #include "base/memory/scoped_callback_factory.h" | 13 #include "base/memory/scoped_callback_factory.h" |
| 14 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #import "chrome/browser/debugger/devtools_window.h" | 17 #import "chrome/browser/debugger/devtools_window.h" |
| 18 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 18 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 21 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 21 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 22 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 22 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| 23 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 24 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 24 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 25 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 25 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 26 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 26 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" | 27 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" |
| 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 NSRect thumb_start = GetStartRectRelativeTo(tile); | 491 NSRect thumb_start = GetStartRectRelativeTo(tile); |
| 491 CGFloat scale_to_start = NSWidth(thumb_start) / NSWidth(thumb_rect_); | 492 CGFloat scale_to_start = NSWidth(thumb_start) / NSWidth(thumb_rect_); |
| 492 NSRect rect = | 493 NSRect rect = |
| 493 ScaleRectWithOrigin(favicon_rect_, thumb_rect_.origin, scale_to_start); | 494 ScaleRectWithOrigin(favicon_rect_, thumb_rect_.origin, scale_to_start); |
| 494 rect.origin.x += NSMinX(thumb_start) - NSMinX(thumb_rect_); | 495 rect.origin.x += NSMinX(thumb_start) - NSMinX(thumb_rect_); |
| 495 rect.origin.y += NSMinY(thumb_start) - NSMinY(thumb_rect_); | 496 rect.origin.y += NSMinY(thumb_start) - NSMinY(thumb_rect_); |
| 496 return rect; | 497 return rect; |
| 497 } | 498 } |
| 498 | 499 |
| 499 SkBitmap Tile::favicon() const { | 500 SkBitmap Tile::favicon() const { |
| 500 if (contents_->is_app()) { | 501 if (contents_->extension_tab_helper()->is_app()) { |
| 501 SkBitmap* icon = contents_->tab_contents()->GetExtensionAppIcon(); | 502 SkBitmap* icon = contents_->extension_tab_helper()->GetExtensionAppIcon(); |
| 502 if (icon) | 503 if (icon) |
| 503 return *icon; | 504 return *icon; |
| 504 } | 505 } |
| 505 return contents_->tab_contents()->GetFavicon(); | 506 return contents_->tab_contents()->GetFavicon(); |
| 506 } | 507 } |
| 507 | 508 |
| 508 NSRect Tile::GetTitleStartRectRelativeTo(const Tile& tile) const { | 509 NSRect Tile::GetTitleStartRectRelativeTo(const Tile& tile) const { |
| 509 NSRect thumb_start = GetStartRectRelativeTo(tile); | 510 NSRect thumb_start = GetStartRectRelativeTo(tile); |
| 510 CGFloat scale_to_start = NSWidth(thumb_start) / NSWidth(thumb_rect_); | 511 CGFloat scale_to_start = NSWidth(thumb_start) / NSWidth(thumb_rect_); |
| 511 NSRect rect = | 512 NSRect rect = |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 tile.set_tab_contents(contents); | 1709 tile.set_tab_contents(contents); |
| 1709 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; | 1710 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; |
| 1710 [thumbLayer setTabContents:contents]; | 1711 [thumbLayer setTabContents:contents]; |
| 1711 } | 1712 } |
| 1712 | 1713 |
| 1713 - (void)tabStripModelDeleted { | 1714 - (void)tabStripModelDeleted { |
| 1714 [self close]; | 1715 [self close]; |
| 1715 } | 1716 } |
| 1716 | 1717 |
| 1717 @end | 1718 @end |
| OLD | NEW |