| 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/extensions/extension_tab_helper.h" |
| 19 #include "chrome/browser/favicon_tab_helper.h" |
| 19 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 22 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 22 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 23 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 23 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 24 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| 24 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 25 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 25 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 26 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 26 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 27 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 27 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" | 28 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" |
| 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 rect.origin.y += NSMinY(thumb_start) - NSMinY(thumb_rect_); | 497 rect.origin.y += NSMinY(thumb_start) - NSMinY(thumb_rect_); |
| 497 return rect; | 498 return rect; |
| 498 } | 499 } |
| 499 | 500 |
| 500 SkBitmap Tile::favicon() const { | 501 SkBitmap Tile::favicon() const { |
| 501 if (contents_->extension_tab_helper()->is_app()) { | 502 if (contents_->extension_tab_helper()->is_app()) { |
| 502 SkBitmap* icon = contents_->extension_tab_helper()->GetExtensionAppIcon(); | 503 SkBitmap* icon = contents_->extension_tab_helper()->GetExtensionAppIcon(); |
| 503 if (icon) | 504 if (icon) |
| 504 return *icon; | 505 return *icon; |
| 505 } | 506 } |
| 506 return contents_->tab_contents()->GetFavicon(); | 507 return contents_->favicon_tab_helper()->GetFavicon(); |
| 507 } | 508 } |
| 508 | 509 |
| 509 NSRect Tile::GetTitleStartRectRelativeTo(const Tile& tile) const { | 510 NSRect Tile::GetTitleStartRectRelativeTo(const Tile& tile) const { |
| 510 NSRect thumb_start = GetStartRectRelativeTo(tile); | 511 NSRect thumb_start = GetStartRectRelativeTo(tile); |
| 511 CGFloat scale_to_start = NSWidth(thumb_start) / NSWidth(thumb_rect_); | 512 CGFloat scale_to_start = NSWidth(thumb_start) / NSWidth(thumb_rect_); |
| 512 NSRect rect = | 513 NSRect rect = |
| 513 ScaleRectWithOrigin(title_rect_, thumb_rect_.origin, scale_to_start); | 514 ScaleRectWithOrigin(title_rect_, thumb_rect_.origin, scale_to_start); |
| 514 rect.origin.x += NSMinX(thumb_start) - NSMinX(thumb_rect_); | 515 rect.origin.x += NSMinX(thumb_start) - NSMinX(thumb_rect_); |
| 515 rect.origin.y += NSMinY(thumb_start) - NSMinY(thumb_rect_); | 516 rect.origin.y += NSMinY(thumb_start) - NSMinY(thumb_rect_); |
| 516 return rect; | 517 return rect; |
| (...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 tile.set_tab_contents(contents); | 1710 tile.set_tab_contents(contents); |
| 1710 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; | 1711 ThumbnailLayer* thumbLayer = [allThumbnailLayers_ objectAtIndex:index]; |
| 1711 [thumbLayer setTabContents:contents]; | 1712 [thumbLayer setTabContents:contents]; |
| 1712 } | 1713 } |
| 1713 | 1714 |
| 1714 - (void)tabStripModelDeleted { | 1715 - (void)tabStripModelDeleted { |
| 1715 [self close]; | 1716 [self close]; |
| 1716 } | 1717 } |
| 1717 | 1718 |
| 1718 @end | 1719 @end |
| OLD | NEW |