| 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 "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "chrome/common/extensions/extension_action.h" | 57 #include "chrome/common/extensions/extension_action.h" |
| 58 #include "chrome/common/extensions/extension_resource.h" | 58 #include "chrome/common/extensions/extension_resource.h" |
| 59 #include "chrome/common/extensions/extension_switch_utils.h" | 59 #include "chrome/common/extensions/extension_switch_utils.h" |
| 60 #include "chrome/common/pref_names.h" | 60 #include "chrome/common/pref_names.h" |
| 61 #include "content/public/browser/notification_service.h" | 61 #include "content/public/browser/notification_service.h" |
| 62 #include "content/public/browser/web_contents.h" | 62 #include "content/public/browser/web_contents.h" |
| 63 #include "grit/generated_resources.h" | 63 #include "grit/generated_resources.h" |
| 64 #include "grit/theme_resources.h" | 64 #include "grit/theme_resources.h" |
| 65 #include "net/base/net_util.h" | 65 #include "net/base/net_util.h" |
| 66 #include "skia/ext/skia_utils_mac.h" | 66 #include "skia/ext/skia_utils_mac.h" |
| 67 #include "third_party/skia/include/core/SkBitmap.h" | |
| 68 #include "ui/base/l10n/l10n_util_mac.h" | 67 #include "ui/base/l10n/l10n_util_mac.h" |
| 69 #include "ui/base/resource/resource_bundle.h" | 68 #include "ui/base/resource/resource_bundle.h" |
| 70 #include "ui/gfx/image/image.h" | 69 #include "ui/gfx/image/image.h" |
| 71 | 70 |
| 72 using content::WebContents; | 71 using content::WebContents; |
| 73 | 72 |
| 74 namespace { | 73 namespace { |
| 75 | 74 |
| 76 // Vertical space between the bottom edge of the location_bar and the first run | 75 // Vertical space between the bottom edge of the location_bar and the first run |
| 77 // bubble arrow point. | 76 // bubble arrow point. |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 const NSPoint point = | 542 const NSPoint point = |
| 544 location_icon_decoration_->GetBubblePointInFrame(frame); | 543 location_icon_decoration_->GetBubblePointInFrame(frame); |
| 545 return [field_ convertPoint:point toView:nil]; | 544 return [field_ convertPoint:point toView:nil]; |
| 546 } | 545 } |
| 547 } | 546 } |
| 548 | 547 |
| 549 NSImage* LocationBarViewMac::GetKeywordImage(const string16& keyword) { | 548 NSImage* LocationBarViewMac::GetKeywordImage(const string16& keyword) { |
| 550 const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile( | 549 const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile( |
| 551 profile_)->GetTemplateURLForKeyword(keyword); | 550 profile_)->GetTemplateURLForKeyword(keyword); |
| 552 if (template_url && template_url->IsExtensionKeyword()) { | 551 if (template_url && template_url->IsExtensionKeyword()) { |
| 553 const SkBitmap& bitmap = profile_->GetExtensionService()-> | 552 return profile_->GetExtensionService()->GetOmniboxIcon( |
| 554 GetOmniboxIcon(template_url->GetExtensionId()); | 553 template_url->GetExtensionId()).AsNSImage(); |
| 555 return gfx::SkBitmapToNSImage(bitmap); | |
| 556 } | 554 } |
| 557 | 555 |
| 558 return OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH); | 556 return OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH); |
| 559 } | 557 } |
| 560 | 558 |
| 561 void LocationBarViewMac::Observe(int type, | 559 void LocationBarViewMac::Observe(int type, |
| 562 const content::NotificationSource& source, | 560 const content::NotificationSource& source, |
| 563 const content::NotificationDetails& details) { | 561 const content::NotificationDetails& details) { |
| 564 switch (type) { | 562 switch (type) { |
| 565 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { | 563 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); | 755 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
| 758 } | 756 } |
| 759 | 757 |
| 760 void LocationBarViewMac::UpdateZoomDecoration() { | 758 void LocationBarViewMac::UpdateZoomDecoration() { |
| 761 TabContents* tab_contents = GetTabContents(); | 759 TabContents* tab_contents = GetTabContents(); |
| 762 if (!tab_contents) | 760 if (!tab_contents) |
| 763 return; | 761 return; |
| 764 | 762 |
| 765 zoom_decoration_->Update(tab_contents->zoom_controller()); | 763 zoom_decoration_->Update(tab_contents->zoom_controller()); |
| 766 } | 764 } |
| OLD | NEW |