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