Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm

Issue 12042096: Move page action manifest parsing out of Extension; the first multi-key manifest handler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/extensions/extension_installed_bubble_controlle r.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle r.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
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/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 14 matching lines...) Expand all
25 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" 25 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h"
26 #include "chrome/browser/ui/cocoa/info_bubble_view.h" 26 #include "chrome/browser/ui/cocoa/info_bubble_view.h"
27 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 27 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
28 #include "chrome/browser/ui/cocoa/new_tab_button.h" 28 #include "chrome/browser/ui/cocoa/new_tab_button.h"
29 #include "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 29 #include "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
30 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 30 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
31 #include "chrome/browser/ui/singleton_tabs.h" 31 #include "chrome/browser/ui/singleton_tabs.h"
32 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" 32 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
33 #include "chrome/common/chrome_notification_types.h" 33 #include "chrome/common/chrome_notification_types.h"
34 #include "chrome/common/extensions/api/commands/commands_handler.h" 34 #include "chrome/common/extensions/api/commands/commands_handler.h"
35 #include "chrome/common/extensions/api/extension_action/action_info.h"
35 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" 36 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h"
36 #include "chrome/common/extensions/extension.h" 37 #include "chrome/common/extensions/extension.h"
37 #include "chrome/common/url_constants.h" 38 #include "chrome/common/url_constants.h"
38 #include "content/public/browser/notification_details.h" 39 #include "content/public/browser/notification_details.h"
39 #include "content/public/browser/notification_registrar.h" 40 #include "content/public/browser/notification_registrar.h"
40 #include "content/public/browser/notification_source.h" 41 #include "content/public/browser/notification_source.h"
41 #include "grit/chromium_strings.h" 42 #include "grit/chromium_strings.h"
42 #include "grit/generated_resources.h" 43 #include "grit/generated_resources.h"
43 #import "skia/ext/skia_utils_mac.h" 44 #import "skia/ext/skia_utils_mac.h"
44 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" 45 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 124
124 if (bundle_) { 125 if (bundle_) {
125 type_ = extension_installed_bubble::kBundle; 126 type_ = extension_installed_bubble::kBundle;
126 } else if (extension->is_app()) { 127 } else if (extension->is_app()) {
127 type_ = extension_installed_bubble::kApp; 128 type_ = extension_installed_bubble::kApp;
128 } else if (!extensions::OmniboxInfo::GetKeyword(extension).empty()) { 129 } else if (!extensions::OmniboxInfo::GetKeyword(extension).empty()) {
129 type_ = extension_installed_bubble::kOmniboxKeyword; 130 type_ = extension_installed_bubble::kOmniboxKeyword;
130 } else if (extension_action_manager->GetBrowserAction(*extension)) { 131 } else if (extension_action_manager->GetBrowserAction(*extension)) {
131 type_ = extension_installed_bubble::kBrowserAction; 132 type_ = extension_installed_bubble::kBrowserAction;
132 } else if (extension_action_manager->GetPageAction(*extension) && 133 } else if (extension_action_manager->GetPageAction(*extension) &&
133 extensions::OmniboxInfo::IsVerboseInstallMessage(extension)) { 134 extensions::ActionInfo::IsVerboseInstallMessage(extension)) {
134 type_ = extension_installed_bubble::kPageAction; 135 type_ = extension_installed_bubble::kPageAction;
135 } else { 136 } else {
136 type_ = extension_installed_bubble::kGeneric; 137 type_ = extension_installed_bubble::kGeneric;
137 } 138 }
138 139
139 if (type_ == extension_installed_bubble::kBundle) { 140 if (type_ == extension_installed_bubble::kBundle) {
140 [self showWindow:self]; 141 [self showWindow:self];
141 } else { 142 } else {
142 // Start showing window only after extension has fully loaded. 143 // Start showing window only after extension has fully loaded.
143 extensionObserver_.reset(new ExtensionLoadedNotificationObserver( 144 extensionObserver_.reset(new ExtensionLoadedNotificationObserver(
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 return; 610 return;
610 } 611 }
611 612
612 NSRect headingFrame = [heading_ frame]; 613 NSRect headingFrame = [heading_ frame];
613 headingFrame.origin.y = newWindowHeight - ( 614 headingFrame.origin.y = newWindowHeight - (
614 NSHeight(headingFrame) + 615 NSHeight(headingFrame) +
615 extension_installed_bubble::kOuterVerticalMargin); 616 extension_installed_bubble::kOuterVerticalMargin);
616 [heading_ setFrame:headingFrame]; 617 [heading_ setFrame:headingFrame];
617 618
618 NSRect howToManageFrame = [howToManage_ frame]; 619 NSRect howToManageFrame = [howToManage_ frame];
619 if (extensions::OmniboxInfo::IsVerboseInstallMessage(extension_)) { 620 if (!extensions::OmniboxInfo::GetKeyword(extension_).empty() ||
621 extensions::ActionInfo::GetBrowserActionInfo(extension_) ||
622 extensions::ActionInfo::IsVerboseInstallMessage(extension_)) {
620 // For browser actions, page actions and omnibox keyword show the 623 // For browser actions, page actions and omnibox keyword show the
621 // 'how to use' message before the 'how to manage' message. 624 // 'how to use' message before the 'how to manage' message.
622 NSRect howToUseFrame = [howToUse_ frame]; 625 NSRect howToUseFrame = [howToUse_ frame];
623 howToUseFrame.origin.y = headingFrame.origin.y - ( 626 howToUseFrame.origin.y = headingFrame.origin.y - (
624 NSHeight(howToUseFrame) + 627 NSHeight(howToUseFrame) +
625 extension_installed_bubble::kInnerVerticalMargin); 628 extension_installed_bubble::kInnerVerticalMargin);
626 [howToUse_ setFrame:howToUseFrame]; 629 [howToUse_ setFrame:howToUseFrame];
627 630
628 howToManageFrame.origin.y = howToUseFrame.origin.y - ( 631 howToManageFrame.origin.y = howToUseFrame.origin.y - (
629 NSHeight(howToManageFrame) + 632 NSHeight(howToManageFrame) +
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 ExtensionInstallUI::OpenAppInstalledUI(browser_, extension_->id()); 697 ExtensionInstallUI::OpenAppInstalledUI(browser_, extension_->id());
695 } 698 }
696 699
697 - (void)awakeFromNib { 700 - (void)awakeFromNib {
698 if (bundle_) 701 if (bundle_)
699 return; 702 return;
700 [self initializeLabel]; 703 [self initializeLabel];
701 } 704 }
702 705
703 @end 706 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698