summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrfevang@chromium.org <rfevang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-23 00:34:53 +0000
committerrfevang@chromium.org <rfevang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-23 00:34:53 +0000
commit1cf7fa27e1ff91a0182b8ec995d0c644dc4e9cf3 (patch)
treed0c63a602bbca28d43ffb05871ac81ea1d421ffc
parent0852de2eadb85c5f59319a29d77c2353e06b1236 (diff)
downloadchromium_src-1cf7fa27e1ff91a0182b8ec995d0c644dc4e9cf3.zip
chromium_src-1cf7fa27e1ff91a0182b8ec995d0c644dc4e9cf3.tar.gz
chromium_src-1cf7fa27e1ff91a0182b8ec995d0c644dc4e9cf3.tar.bz2
Remove ActionBox and related code.
ActionBox is no more, and is unlikely to be coming back. This CL removes old ActionBox code, associated resources, feature switch and extension API. BUG=234737 Review URL: https://chromiumcodereview.appspot.com/19695004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213009 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/chrome_command_ids.h5
-rw-r--r--chrome/app/generated_resources.grd12
-rw-r--r--chrome/app/theme/default_100_percent/common/action_box_button_hover.pngbin129 -> 0 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/action_box_button_normal.pngbin129 -> 0 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/action_box_button_pressed.pngbin129 -> 0 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/action_box_button_hover.pngbin223 -> 0 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/action_box_button_normal.pngbin223 -> 0 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/action_box_button_pressed.pngbin223 -> 0 bytes
-rw-r--r--chrome/app/theme/theme_resources.grd3
-rw-r--r--chrome/app/theme/touch_100_percent/common/action_box_button_hover.pngbin143 -> 0 bytes
-rw-r--r--chrome/app/theme/touch_100_percent/common/action_box_button_normal.pngbin143 -> 0 bytes
-rw-r--r--chrome/app/theme/touch_100_percent/common/action_box_button_pressed.pngbin143 -> 0 bytes
-rw-r--r--chrome/browser/about_flags.cc8
-rw-r--r--chrome/browser/extensions/api/page_launcher/page_launcher_api.cc39
-rw-r--r--chrome/browser/extensions/api/page_launcher/page_launcher_api.h28
-rw-r--r--chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.h107
-rw-r--r--chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm473
-rw-r--r--chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm188
-rw-r--r--chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h16
-rw-r--r--chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm41
-rw-r--r--chrome/browser/ui/cocoa/location_bar/plus_decoration.h62
-rw-r--r--chrome/browser/ui/cocoa/location_bar/plus_decoration.mm87
-rw-r--r--chrome/browser/ui/gtk/action_box_button_gtk.cc164
-rw-r--r--chrome/browser/ui/gtk/action_box_button_gtk.h62
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.cc22
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.h4
-rw-r--r--chrome/browser/ui/omnibox/action_box_browsertest.cc98
-rw-r--r--chrome/browser/ui/omnibox/location_bar.h4
-rw-r--r--chrome/browser/ui/toolbar/action_box_button_controller.cc184
-rw-r--r--chrome/browser/ui/toolbar/action_box_button_controller.h90
-rw-r--r--chrome/browser/ui/toolbar/action_box_context_menu_controller.cc173
-rw-r--r--chrome/browser/ui/toolbar/action_box_context_menu_controller.h54
-rw-r--r--chrome/browser/ui/toolbar/action_box_menu_model.cc67
-rw-r--r--chrome/browser/ui/toolbar/action_box_menu_model.h54
-rw-r--r--chrome/browser/ui/toolbar/action_box_menu_model_unittest.cc129
-rw-r--r--chrome/browser/ui/views/action_box_context_menu.cc38
-rw-r--r--chrome/browser/ui/views/action_box_context_menu.h52
-rw-r--r--chrome/browser/ui/views/action_box_menu.cc128
-rw-r--r--chrome/browser/ui/views/action_box_menu.h58
-rw-r--r--chrome/browser/ui/views/location_bar/action_box_button_view.cc59
-rw-r--r--chrome/browser/ui/views/location_bar/action_box_button_view.h55
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc45
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.h4
-rw-r--r--chrome/chrome_browser_extensions.gypi2
-rw-r--r--chrome/chrome_browser_ui.gypi18
-rw-r--r--chrome/chrome_common.gypi2
-rw-r--r--chrome/chrome_nibs.gyp2
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/chrome_tests_unit.gypi3
-rw-r--r--chrome/common/chrome_switches.cc3
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/common/extensions/api/api.gyp1
-rw-r--r--chrome/common/extensions/api/extension_action/action_info.cc10
-rw-r--r--chrome/common/extensions/api/extension_action/action_info.h6
-rw-r--r--chrome/common/extensions/api/page_launcher.idl28
-rw-r--r--chrome/common/extensions/api/page_launcher/page_launcher_handler.cc46
-rw-r--r--chrome/common/extensions/api/page_launcher/page_launcher_handler.h31
-rw-r--r--chrome/common/extensions/api/page_launcher/page_launcher_manifest_unittest.cc48
-rw-r--r--chrome/common/extensions/chrome_manifest_handlers.cc2
-rw-r--r--chrome/common/extensions/extension_manifest_constants.cc3
-rw-r--r--chrome/common/extensions/extension_manifest_constants.h2
-rw-r--r--chrome/common/extensions/feature_switch.cc10
-rw-r--r--chrome/common/extensions/feature_switch.h1
-rw-r--r--chrome/test/data/extensions/page_launcher/app_page_launcher_not_present.json9
-rw-r--r--chrome/test/data/extensions/page_launcher/app_page_launcher_present.json13
-rw-r--r--chrome/test/data/extensions/page_launcher/extension_page_launcher_present.json8
-rw-r--r--ui/resources/default_100_percent/cros/action_box_button_hover.pngbin115 -> 0 bytes
-rw-r--r--ui/resources/default_100_percent/cros/action_box_button_normal.pngbin115 -> 0 bytes
-rw-r--r--ui/resources/default_100_percent/cros/action_box_button_pressed.pngbin115 -> 0 bytes
-rw-r--r--ui/resources/default_200_percent/cros/action_box_button_hover.pngbin201 -> 0 bytes
-rw-r--r--ui/resources/default_200_percent/cros/action_box_button_normal.pngbin200 -> 0 bytes
-rw-r--r--ui/resources/default_200_percent/cros/action_box_button_pressed.pngbin200 -> 0 bytes
-rw-r--r--ui/resources/ui_resources.grd3
73 files changed, 7 insertions, 2859 deletions
diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h
index 1925f24..894956e 100644
--- a/chrome/app/chrome_command_ids.h
+++ b/chrome/app/chrome_command_ids.h
@@ -335,11 +335,6 @@
#define IDC_MEDIA_CONTEXT_MEDIA_STREAM_CAPTURE_LIST_LAST 51399
#define IDC_MEDIA_STREAM_DEVICE_ALWAYS_ALLOW 51400
-// Context menu items for extensions in the action box
-#define IDC_ACTION_BOX_EXTENSION_HOMEPAGE 51500
-#define IDC_ACTION_BOX_EXTENSION_MANAGE 51501
-#define IDC_ACTION_BOX_EXTENSION_UNINSTALL 51502
-
// Protocol handler menu entries
#define IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST 52000
#define IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST 52199
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index c4997de..4b3e91d 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -6522,12 +6522,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_ENABLE_APP_WINDOW_CONTROLS_DESCRIPTION" desc="Description of the 'Enable 'window-controls' element' lab.">
Enables using 'window-controls' HTML elements in packaged apps.
</message>
- <message name="IDS_FLAGS_ACTION_BOX_NAME" desc="Name of the 'Action Box' lab.">
- Action box
- </message>
- <message name="IDS_FLAGS_ACTION_BOX_DESCRIPTION" desc="Description of the 'Action Box' lab.">
- Enable or disable the "Action Box" experimental toolbar UI.
- </message>
<message name="IDS_FLAGS_SCRIPT_BADGES_NAME" desc="Name of the 'Script Badges' lab.">
Script badges
</message>
@@ -7989,9 +7983,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_TOOLTIP_NEW_TAB" desc="The tooltip for the new tab button">
New tab
</message>
- <message name="IDS_TOOLTIP_ACTION_BOX_BUTTON" desc="The tooltip for action box button">
- Actions
- </message>
<message name="IDS_TOOLTIP_MIC_SEARCH" desc="The tooltip for search-by-voice button">
Voice search
</message>
@@ -8096,9 +8087,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_ACCNAME_WEB_CONTENTS" desc="The accessible name for the web contents.">
Web Contents
</message>
- <message name="IDS_ACCNAME_ACTION_BOX_BUTTON" desc="The accessible name for the action box button.">
- Actions
- </message>
<if expr="pp_ifdef('ios')">
<message name="IDS_ACCNAME_CLEAR_TEXT" desc="The accessibility label for the clear text button in the location bar [Length: unlimited].">
Clear Text
diff --git a/chrome/app/theme/default_100_percent/common/action_box_button_hover.png b/chrome/app/theme/default_100_percent/common/action_box_button_hover.png
deleted file mode 100644
index 02492f3..0000000
--- a/chrome/app/theme/default_100_percent/common/action_box_button_hover.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/action_box_button_normal.png b/chrome/app/theme/default_100_percent/common/action_box_button_normal.png
deleted file mode 100644
index 6cd4d54..0000000
--- a/chrome/app/theme/default_100_percent/common/action_box_button_normal.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/action_box_button_pressed.png b/chrome/app/theme/default_100_percent/common/action_box_button_pressed.png
deleted file mode 100644
index a83051f..0000000
--- a/chrome/app/theme/default_100_percent/common/action_box_button_pressed.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/action_box_button_hover.png b/chrome/app/theme/default_200_percent/common/action_box_button_hover.png
deleted file mode 100644
index bb1f380..0000000
--- a/chrome/app/theme/default_200_percent/common/action_box_button_hover.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/action_box_button_normal.png b/chrome/app/theme/default_200_percent/common/action_box_button_normal.png
deleted file mode 100644
index f351037..0000000
--- a/chrome/app/theme/default_200_percent/common/action_box_button_normal.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/action_box_button_pressed.png b/chrome/app/theme/default_200_percent/common/action_box_button_pressed.png
deleted file mode 100644
index 8b5be81..0000000
--- a/chrome/app/theme/default_200_percent/common/action_box_button_pressed.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index 63fec8e..d87c895 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -28,9 +28,6 @@
BECAUSE YOUR RESOURCES ARE FUNCTIONALLY RELATED OR FALL UNDER THE
SAME CONDITIONALS. -->
<structure type="chrome_scaled_image" name="IDR_ACCESSED_COOKIES" file="accessed_cookies.png" />
- <structure type="chrome_scaled_image" name="IDR_ACTION_BOX_BUTTON_HOVER" file="common/action_box_button_hover.png" />
- <structure type="chrome_scaled_image" name="IDR_ACTION_BOX_BUTTON_NORMAL" file="common/action_box_button_normal.png" />
- <structure type="chrome_scaled_image" name="IDR_ACTION_BOX_BUTTON_PRESSED" file="common/action_box_button_pressed.png" />
<structure type="chrome_scaled_image" name="IDR_ALLOWED_DOWNLOADS" file="common/allowed_downloads.png" />
<structure type="chrome_scaled_image" name="IDR_ALLOWED_FULLSCREEN" file="common/allowed_fullscreen.png" />
<structure type="chrome_scaled_image" name="IDR_ALLOWED_IMAGES" file="common/allowed_images.png" />
diff --git a/chrome/app/theme/touch_100_percent/common/action_box_button_hover.png b/chrome/app/theme/touch_100_percent/common/action_box_button_hover.png
deleted file mode 100644
index ae969ae..0000000
--- a/chrome/app/theme/touch_100_percent/common/action_box_button_hover.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/touch_100_percent/common/action_box_button_normal.png b/chrome/app/theme/touch_100_percent/common/action_box_button_normal.png
deleted file mode 100644
index 2113545..0000000
--- a/chrome/app/theme/touch_100_percent/common/action_box_button_normal.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/touch_100_percent/common/action_box_button_pressed.png b/chrome/app/theme/touch_100_percent/common/action_box_button_pressed.png
deleted file mode 100644
index 1603b66..0000000
--- a/chrome/app/theme/touch_100_percent/common/action_box_button_pressed.png
+++ /dev/null
Binary files differ
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 6ca3032..fe000fc 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -577,14 +577,6 @@ const Experiment kExperiments[] = {
SINGLE_VALUE_TYPE(switches::kEnableAppWindowControls)
},
{
- "action-box",
- IDS_FLAGS_ACTION_BOX_NAME,
- IDS_FLAGS_ACTION_BOX_DESCRIPTION,
- kOsDesktop,
- ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(switches::kActionBox, "1",
- switches::kActionBox, "0")
- },
- {
"script-badges",
IDS_FLAGS_SCRIPT_BADGES_NAME,
IDS_FLAGS_SCRIPT_BADGES_DESCRIPTION,
diff --git a/chrome/browser/extensions/api/page_launcher/page_launcher_api.cc b/chrome/browser/extensions/api/page_launcher/page_launcher_api.cc
deleted file mode 100644
index e0f8241..0000000
--- a/chrome/browser/extensions/api/page_launcher/page_launcher_api.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/extensions/api/page_launcher/page_launcher_api.h"
-
-#include "base/lazy_instance.h"
-#include "base/memory/linked_ptr.h"
-#include "chrome/browser/extensions/event_router.h"
-#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/common/extensions/api/page_launcher.h"
-#include "url/gurl.h"
-
-namespace extensions {
-
-// static
-void PageLauncherAPI::DispatchOnClickedEvent(
- Profile* profile,
- const std::string& extension_id,
- const GURL& url,
- const std::string& mimetype,
- const std::string* page_title,
- const std::string* selected_text) {
- api::page_launcher::PageData data;
- data.url = url.spec();
- data.mimetype = mimetype;
- if (page_title)
- data.title.reset(new std::string(*page_title));
- if (selected_text)
- data.selection_text.reset(new std::string(*selected_text));
-
- scoped_ptr<Event> event(
- new Event("pageLauncher.onClicked",
- api::page_launcher::OnClicked::Create(data)));
- EventRouter* event_router = ExtensionSystem::Get(profile)->event_router();
- event_router->DispatchEventToExtension(extension_id, event.Pass());
-}
-
-} // namespace extensions
diff --git a/chrome/browser/extensions/api/page_launcher/page_launcher_api.h b/chrome/browser/extensions/api/page_launcher/page_launcher_api.h
deleted file mode 100644
index a5c7757..0000000
--- a/chrome/browser/extensions/api/page_launcher/page_launcher_api.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_EXTENSIONS_API_PAGE_LAUNCHER_PAGE_LAUNCHER_API_H_
-#define CHROME_BROWSER_EXTENSIONS_API_PAGE_LAUNCHER_PAGE_LAUNCHER_API_H_
-
-#include <string>
-
-class GURL;
-class Profile;
-
-namespace extensions {
-
-class PageLauncherAPI {
- public:
- static void DispatchOnClickedEvent(Profile* profile,
- const std::string& extension_id,
- const GURL& url,
- const std::string& mimetype,
- const std::string* page_title,
- const std::string* selected_text);
-};
-
-} // namespace extensions
-
-
-#endif // CHROME_BROWSER_EXTENSIONS_API_PAGE_LAUNCHER_PAGE_LAUNCHER_API_H_
diff --git a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.h b/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.h
deleted file mode 100644
index f0a38ac..0000000
--- a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ACTION_BOX_MENU_BUBBLE_CONTROLLER_H_
-#define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ACTION_BOX_MENU_BUBBLE_CONTROLLER_H_
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/mac/scoped_nsobject.h"
-#include "base/memory/scoped_ptr.h"
-#import "chrome/browser/ui/cocoa/base_bubble_controller.h"
-#import "ui/base/cocoa/tracking_area.h"
-
-class ActionBoxMenuModel;
-class ExtensionIconLoaderBridge;
-class Profile;
-
-// This window controller manages the action box popup menu.
-@interface ActionBoxMenuBubbleController : BaseBubbleController {
- @private
- Profile* profile_;
-
- // The model that contains the data from the backend.
- scoped_ptr<ActionBoxMenuModel> model_;
-
- // Array of the below view controllers.
- base::scoped_nsobject<NSMutableArray> items_;
-}
-
-// Designated initializer. |point| must be in screen coordinates.
-- (id)initWithModel:(scoped_ptr<ActionBoxMenuModel>)model
- parentWindow:(NSWindow*)parent
- anchoredAt:(NSPoint)point
- profile:(Profile*)profile;
-
-// Accesses the model.
-- (ActionBoxMenuModel*)model;
-
-- (NSMutableArray*)items;
-
-// Executes the action of a given menu item.
-- (IBAction)itemSelected:(id)sender;
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////
-
-// This view controller manages the menu item XIB.
-@interface ActionBoxMenuItemController : NSViewController {
- @private
- // The parent menu controller owns this.
- __weak ActionBoxMenuBubbleController* controller_;
-
- size_t modelIndex_;
-
- // Tracks whether this item is currently highlighted.
- BOOL isHighlighted_;
-
- // If the icon comes from an extension, this wraps the extension icon loader.
- scoped_ptr<ExtensionIconLoaderBridge> extensionIconLoaderBridge_;
-
- // Instance variables that back the outlets.
- IBOutlet __weak NSImageView* iconView_;
- IBOutlet __weak NSTextField* nameField_;
-}
-@property(readonly, nonatomic) size_t modelIndex;
-@property(assign, nonatomic) BOOL isHighlighted;
-@property(readonly, nonatomic) NSImageView* iconView;
-@property(assign, nonatomic) NSTextField* nameField;
-
-// Designated initializer.
-- (id)initWithModelIndex:(size_t)modelIndex
- menuController:(ActionBoxMenuBubbleController*)controller
- profile:(Profile*)profile;
-
-// Highlights the subviews appropriately for a given event.
-- (void)highlightForEvent:(NSEvent*)event;
-
-// Execute the action of a given menu item.
-- (IBAction)itemSelected:(id)sender;
-
-// Called when |extensionIconLoaderBridge_| changes, updates |iconView_|.
-- (void)onExtensionIconImageChanged:(NSImage*)image;
-
-@end
-
-////////////////////////////////////////////////////////////////////////////////
-
-// Simple button cell to get tracking and mouse events forwarded back to the
-// view controller for changing highlight style of the item subviews. This is
-// an invisible button that underlays most of the menu item and is responsible
-// for performing the attached action.
-@interface ActionBoxMenuItemView : NSView {
- @private
- // The controller that manages this.
- IBOutlet __weak ActionBoxMenuItemController* viewController_;
-
- // Used to highlight the background on hover.
- ui::ScopedCrTrackingArea trackingArea_;
-}
-
-@property(assign, nonatomic) ActionBoxMenuItemController* viewController;
-
-@end
-
-#endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ACTION_BOX_MENU_BUBBLE_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm b/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm
deleted file mode 100644
index d65dc50..0000000
--- a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm
+++ /dev/null
@@ -1,473 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.h"
-
-#include "base/mac/bundle_locations.h"
-#include "base/mac/foundation_util.h"
-#include "base/mac/mac_util.h"
-#include "base/strings/sys_string_conversions.h"
-#include "chrome/browser/extensions/extension_icon_image.h"
-#import "chrome/browser/ui/cocoa/browser_window_utils.h"
-#import "chrome/browser/ui/cocoa/info_bubble_view.h"
-#import "chrome/browser/ui/cocoa/info_bubble_window.h"
-#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
-#include "chrome/common/extensions/api/extension_action/action_info.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_constants.h"
-#include "chrome/common/extensions/manifest_handlers/icons_handler.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "skia/ext/skia_utils_mac.h"
-#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
-#import "ui/base/cocoa/cocoa_event_utils.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/image/image.h"
-#include "ui/gfx/image/image_skia_util_mac.h"
-#include "ui/native_theme/native_theme.h"
-
-@interface ActionBoxMenuBubbleController (Private)
-- (id)highlightedItem;
-- (void)keyDown:(NSEvent*)theEvent;
-- (void)moveDown:(id)sender;
-- (void)moveUp:(id)sender;
-- (void)highlightNextItemByDelta:(NSInteger)delta;
-- (void)highlightItem:(ActionBoxMenuItemController*)newItem;
-@end
-
-@interface ActionBoxMenuItemView (Private)
-- (NSColor*)highlightedMenuItemBackgroundColor;
-@end
-
-namespace {
-
-// Some reasonable values for the menu geometry.
-const CGFloat kBubbleMinWidth = 175;
-const CGFloat kBubbleMaxWidth = 800;
-
-// Distance between the top/bottom of the bubble and the first/last menu item.
-const CGFloat kVerticalPadding = 7.0;
-
-// Minimum distance between the right of a menu item and the right border.
-const CGFloat kRightMargin = 20.0;
-
-// Alpha of the black rectangle overlayed on the item hovered over.
-const CGFloat kSelectionAlpha = 0.06;
-
-} // namespace
-
-// extension Icon Loader Bridge ////////////////////////////////////////////////
-
-class ExtensionIconLoaderBridge : public extensions::IconImage::Observer {
- public:
- ExtensionIconLoaderBridge(Profile* profile,
- const extensions::Extension* extension,
- ActionBoxMenuItemController* controller)
- : controller_(controller) {
- const extensions::ActionInfo* page_launcher_info =
- extensions::ActionInfo::GetPageLauncherInfo(extension);
- DCHECK(page_launcher_info);
- icon_loader_.reset(new extensions::IconImage(
- profile,
- extension,
- page_launcher_info->default_icon,
- extension_misc::EXTENSION_ICON_ACTION,
- extensions::IconsInfo::GetDefaultAppIcon(),
- this));
- OnExtensionIconImageChanged(icon_loader_.get());
- }
-
- private:
- virtual void OnExtensionIconImageChanged(
- extensions::IconImage* image) OVERRIDE {
- [controller_ onExtensionIconImageChanged:
- gfx::NSImageFromImageSkia(image->image_skia())];
- }
-
- scoped_ptr<extensions::IconImage> icon_loader_;
- ActionBoxMenuItemController* controller_; // Weak.
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionIconLoaderBridge);
-};
-
-@implementation ActionBoxMenuBubbleController
-
-- (id)initWithModel:(scoped_ptr<ActionBoxMenuModel>)model
- parentWindow:(NSWindow*)parent
- anchoredAt:(NSPoint)point
- profile:(Profile*)profile {
- // Use an arbitrary height because it will reflect the size of the content.
- NSRect contentRect = NSMakeRect(0, 0, kBubbleMinWidth, 150);
- // Create an empty window into which content is placed.
- base::scoped_nsobject<InfoBubbleWindow> window(
- [[InfoBubbleWindow alloc] initWithContentRect:contentRect
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:NO]);
- [window setAllowedAnimations:info_bubble::kAnimateNone];
- if (self = [super initWithWindow:window
- parentWindow:parent
- anchoredAt:point]) {
- profile_ = profile;
- model_.reset(model.release());
-
- [[self bubble] setAlignment:info_bubble::kAlignRightEdgeToAnchorEdge];
- [[self bubble] setArrowLocation:info_bubble::kNoArrow];
- ui::NativeTheme* nativeTheme = ui::NativeTheme::instance();
- [[self bubble] setBackgroundColor:
- gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
- ui::NativeTheme::kColorId_DialogBackground))];
- [self performLayout];
- }
- return self;
-}
-
-- (ActionBoxMenuModel*)model {
- return model_.get();
-}
-
-- (NSMutableArray*)items {
- return items_;
-}
-
-- (IBAction)itemSelected:(id)sender {
- // If Enter is pressed but nothing is highlighted, don't activate anything.
- if (!sender)
- return;
-
- // Close the current window and activate the parent browser window, otherwise
- // the bookmark popup refuses to show.
- [self close];
- [BrowserWindowUtils
- activateWindowForController:[[self parentWindow] windowController]];
- size_t modelIndex = [sender modelIndex];
- DCHECK(model_.get());
- int eventFlags = ui::EventFlagsFromNSEvent([NSApp currentEvent]);
- model_->ActivatedAt(modelIndex, eventFlags);
-}
-
-// Private /////////////////////////////////////////////////////////////////////
-
-- (void)performLayout {
- NSView* contentView = [[self window] contentView];
-
- // Reset the array of controllers and remove all the views.
- items_.reset([[NSMutableArray alloc] init]);
- [contentView setSubviews:[NSArray array]];
-
- // Leave some space at the bottom of the menu.
- CGFloat yOffset = kVerticalPadding;
-
- // Keep track of a potential separator to resize it when we know the width.
- base::scoped_nsobject<NSBox> separatorView;
-
- // Loop over the items in reverse, constructing the menu items.
- CGFloat width = kBubbleMinWidth;
- CGFloat minX = NSMinX([contentView bounds]);
- for (int i = model_->GetItemCount() - 1; i >= 0; --i) {
- if (model_->GetTypeAt(i) == ui::MenuModel::TYPE_SEPARATOR) {
- const CGFloat kSeparatorHeight = 1.0;
- // Only supports one separator.
- DCHECK(!separatorView);
- yOffset += kVerticalPadding + kSeparatorHeight;
- separatorView.reset([[NSBox alloc]
- initWithFrame:NSMakeRect(0, yOffset, width, kSeparatorHeight)]);
- [separatorView setBoxType:NSBoxCustom];
- ui::NativeTheme* nativeTheme = ui::NativeTheme::instance();
- [separatorView setBorderColor:
- gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
- ui::NativeTheme::kColorId_MenuSeparatorColor))];
- [contentView addSubview:separatorView];
- yOffset += kVerticalPadding;
- } else {
- // Create the item controller. Autorelease it because it will be owned
- // by the |items_| array.
- base::scoped_nsobject<ActionBoxMenuItemController> itemController(
- [[ActionBoxMenuItemController alloc] initWithModelIndex:i
- menuController:self
- profile:profile_]);
-
- // Adjust the name field to fit the string.
- [GTMUILocalizerAndLayoutTweaker sizeToFitView:[itemController nameField]];
-
- // Expand the size of the window if required to fit the menu item.
- width = std::max(width,
- NSMaxX([[itemController nameField] frame]) - minX + kRightMargin);
-
- // Add the item to the content view.
- [[itemController view] setFrameOrigin:NSMakePoint(0, yOffset)];
- [contentView addSubview:[itemController view]];
- yOffset += NSHeight([[itemController view] frame]);
-
- // Keep track of the view controller.
- [items_ addObject:itemController.get()];
- }
- }
-
- // Leave some space at the top of the menu.
- yOffset += kVerticalPadding;
-
- // Set the window frame, clamping the width at a sensible max.
- NSRect frame = [[self window] frame];
- frame.size.height = yOffset;
- frame.size.width = std::min(width, kBubbleMaxWidth);
-
- // Resize the separator to full width.
- if (separatorView) {
- NSRect separatorFrame = [separatorView frame];
- separatorFrame.size.width = width;
- [separatorView setFrame:separatorFrame];
- }
-
- [[self window] setFrame:frame display:YES];
-}
-
-- (id)highlightedItem {
- for (ActionBoxMenuItemController* item in items_.get()) {
- if ([item isHighlighted]) {
- return item;
- }
- }
- return nil;
-}
-
-- (void)keyDown:(NSEvent*)theEvent {
- // Interpret all possible key events. In particular, this will answer
- // moveDown, moveUp and insertNewline so that the menu can be navigated
- // with keystrokes.
- [self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
-}
-
-- (void)moveDown:(id)sender {
- [self highlightNextItemByDelta:-1];
-}
-
-- (void)moveUp:(id)sender {
- [self highlightNextItemByDelta:1];
-}
-
-- (void)insertNewline:(id)sender {
- [self itemSelected:[self highlightedItem]];
-}
-
-- (void)highlightNextItemByDelta:(NSInteger)delta {
- NSUInteger count = [items_ count];
- if (count == 0)
- return;
-
- // If nothing is selected, select the first (resp. last) item when going up
- // (resp. going down). Otherwise selects the next (resp. previous) item.
- // This code does not wrap around if something is already selected.
-
- // First assumes nothing is selected.
- NSUInteger newIndex = delta < 0 ? (count - 1) : 0;
- NSUInteger oldIndex = [items_ indexOfObject:[self highlightedItem]];
- // oldIndex will be NSNotFound when [self highlightedItem] returns nil.
- if (oldIndex != NSNotFound) {
- // Something is selected, move only if not already at top/bottom.
- newIndex = oldIndex;
- if (newIndex != (delta < 0 ? 0 : count - 1))
- newIndex += delta;
- }
-
- [self highlightItem:[items_ objectAtIndex:newIndex]];
-}
-
-- (void)highlightItem:(ActionBoxMenuItemController*)newItem {
- ActionBoxMenuItemController* oldItem = [self highlightedItem];
- if (oldItem == newItem)
- return;
- [oldItem setIsHighlighted:NO];
- [newItem setIsHighlighted:YES];
-}
-
-@end
-
-// Menu Item Controller ////////////////////////////////////////////////////////
-
-@implementation ActionBoxMenuItemController
-
-@synthesize modelIndex = modelIndex_;
-@synthesize isHighlighted = isHighlighted_;
-@synthesize iconView = iconView_;
-@synthesize nameField = nameField_;
-
-- (id)initWithModelIndex:(size_t)modelIndex
- menuController:(ActionBoxMenuBubbleController*)controller
- profile:(Profile*)profile {
- if ((self = [super initWithNibName:@"ActionBoxMenuItem"
- bundle:base::mac::FrameworkBundle()])) {
- modelIndex_ = modelIndex;
- controller_ = controller;
-
- [self loadView];
-
- gfx::Image icon = gfx::Image();
- ActionBoxMenuModel* model = [controller model];
- if (model->GetIconAt(modelIndex_, &icon)) {
- extensionIconLoaderBridge_.reset();
- [iconView_ setImage:icon.ToNSImage()];
- } else if (model->GetTypeAt(modelIndex_) == ui::MenuModel::TYPE_COMMAND &&
- model->IsItemExtension(modelIndex_)) {
- // Creating an ExtensionIconLoaderBridge will call
- // onExtensionIconImageChanged and set the |iconView_|.
- [iconView_ setImage:nil];
- extensionIconLoaderBridge_.reset(new ExtensionIconLoaderBridge(
- profile,
- model->GetExtensionAt(modelIndex_),
- self));
- } else {
- extensionIconLoaderBridge_.reset();
- [iconView_ setImage:nil];
- }
-
- nameField_.stringValue = base::SysUTF16ToNSString(
- controller.model->GetLabelAt(modelIndex_));
- }
- return self;
-}
-
-- (void)dealloc {
- base::mac::ObjCCastStrict<ActionBoxMenuItemView>(
- self.view).viewController = nil;
- [super dealloc];
-}
-
-- (void)highlightForEvent:(NSEvent*)event {
- switch ([event type]) {
- case NSMouseEntered:
- [controller_ highlightItem:self];
- break;
-
- case NSMouseExited:
- [controller_ highlightItem:nil];
- break;
-
- default:
- NOTREACHED();
- };
-}
-
-- (IBAction)itemSelected:(id)sender {
- [controller_ itemSelected:self];
-}
-
-- (void)setIsHighlighted:(BOOL)isHighlighted {
- if (isHighlighted_ == isHighlighted)
- return;
-
- isHighlighted_ = isHighlighted;
- [[self view] setNeedsDisplay:YES];
-}
-
-- (void)onExtensionIconImageChanged:(NSImage*)image {
- [iconView_ setImage:image];
-}
-
-@end
-
-// Items from the action box menu //////////////////////////////////////////////
-
-@implementation ActionBoxMenuItemView
-
-@synthesize viewController = viewController_;
-
-- (void)updateTrackingAreas {
- if (trackingArea_.get())
- [self removeTrackingArea:trackingArea_.get()];
-
- trackingArea_.reset(
- [[CrTrackingArea alloc] initWithRect:[self bounds]
- options:NSTrackingMouseEnteredAndExited |
- NSTrackingActiveInKeyWindow
- owner:self
- userInfo:nil]);
- [self addTrackingArea:trackingArea_.get()];
-
- [super updateTrackingAreas];
-}
-
-- (BOOL)acceptsFirstResponder {
- return YES;
-}
-
-- (void)mouseUp:(NSEvent*)theEvent {
- [viewController_ itemSelected:self];
-}
-
-- (void)mouseEntered:(NSEvent*)theEvent {
- [viewController_ highlightForEvent:theEvent];
-}
-
-- (void)mouseExited:(NSEvent*)theEvent {
- [viewController_ highlightForEvent:theEvent];
-}
-
-- (void)drawRect:(NSRect)dirtyRect {
- NSColor* backgroundColor = nil;
- if ([viewController_ isHighlighted]) {
- ui::NativeTheme* nativeTheme = ui::NativeTheme::instance();
- backgroundColor = gfx::SkColorToCalibratedNSColor(
- nativeTheme->GetSystemColor(
- ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor));
- } else {
- backgroundColor = [NSColor clearColor];
- }
-
- [backgroundColor set];
- [NSBezierPath fillRect:[self bounds]];
-}
-
-// Make sure the element is focusable for accessibility.
-- (BOOL)canBecomeKeyView {
- return YES;
-}
-
-- (BOOL)accessibilityIsIgnored {
- return NO;
-}
-
-- (NSArray*)accessibilityAttributeNames {
- NSMutableArray* attributes =
- [[[super accessibilityAttributeNames] mutableCopy] autorelease];
- [attributes addObject:NSAccessibilityTitleAttribute];
- [attributes addObject:NSAccessibilityEnabledAttribute];
-
- return attributes;
-}
-
-- (NSArray*)accessibilityActionNames {
- NSArray* parentActions = [super accessibilityActionNames];
- return [parentActions arrayByAddingObject:NSAccessibilityPressAction];
-}
-
-- (id)accessibilityAttributeValue:(NSString*)attribute {
- if ([attribute isEqual:NSAccessibilityRoleAttribute])
- return NSAccessibilityButtonRole;
-
- if ([attribute isEqual:NSAccessibilityRoleDescriptionAttribute])
- return NSAccessibilityRoleDescription(NSAccessibilityButtonRole, nil);
-
- if ([attribute isEqual:NSAccessibilityEnabledAttribute])
- return [NSNumber numberWithBool:YES];
-
- return [super accessibilityAttributeValue:attribute];
-}
-
-- (void)accessibilityPerformAction:(NSString*)action {
- if ([action isEqual:NSAccessibilityPressAction]) {
- [viewController_ itemSelected:self];
- return;
- }
-
- [super accessibilityPerformAction:action];
-}
-
-- (NSColor*)highlightedMenuItemBackgroundColor {
- ui::NativeTheme* nativeTheme = ui::NativeTheme::instance();
- return gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
- ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor));
-}
-
-@end
diff --git a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm
deleted file mode 100644
index 7399ac5..0000000
--- a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.h"
-
-#include "base/command_line.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/extensions/test_extension_system.h"
-#include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
-#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_builder.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-const CGFloat kAnchorPointX = 400;
-const CGFloat kAnchorPointY = 300;
-
-class MenuDelegate : public ui::SimpleMenuModel::Delegate {
- public:
- // Methods for determining the state of specific command ids.
- virtual bool IsCommandIdChecked(int command_id) const OVERRIDE {
- return false;
- }
-
- virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE {
- return true;
- }
-
- virtual bool GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) OVERRIDE {
- return false;
- }
-
- // Performs the action associated with the specified command id.
- virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE {
- }
-};
-
-class ActionBoxMenuBubbleControllerTest : public CocoaProfileTest {
- public:
- ActionBoxMenuBubbleControllerTest() {
- }
-
- virtual void SetUp() OVERRIDE {
- CocoaProfileTest::SetUp();
- ASSERT_TRUE(browser());
-
- // Create a test extension service.
- CommandLine command_line(CommandLine::NO_PROGRAM);
- extensions::TestExtensionSystem* test_ext_system =
- static_cast<extensions::TestExtensionSystem*>(
- extensions::ExtensionSystem::Get(profile()));
- service_ = test_ext_system->CreateExtensionService(
- &command_line, base::FilePath(), false);
- EXPECT_TRUE(service_->extensions_enabled());
- service_->Init();
- }
-
- virtual void TearDown() OVERRIDE {
- // Close our windows.
- [controller_ close];
- CocoaProfileTest::TearDown();
- }
-
- // Add an extension with a page_launcher to the model and the extension
- // service. Call this before calling CreateController.
- scoped_refptr<extensions::Extension> AddPageLauncherExtension(
- ActionBoxMenuModel* model,
- const std::string& page_launcher_title,
- int command_id) {
- scoped_refptr<extensions::Extension> extension =
- extensions::ExtensionBuilder()
- .SetManifest(extensions::DictionaryBuilder()
- .Set("name", "Extension with page launcher")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("page_launcher", extensions::DictionaryBuilder()
- .Set("default_title", page_launcher_title))
- .Set("app", extensions::DictionaryBuilder()
- .Set("background", extensions::DictionaryBuilder()
- .Set("page", ""))))
- .Build();
- service_->AddExtension(extension.get());
- model->AddExtension(*extension.get(), command_id);
- return extension;
- }
-
- // Creates a controller based on |model|. Takes ownership of |model|.
- void CreateController(scoped_ptr<ActionBoxMenuModel> model) {
- // The bubble controller will release itself when the window closes.
- controller_ = [[ActionBoxMenuBubbleController alloc]
- initWithModel:model.Pass()
- parentWindow:test_window()
- anchoredAt:NSMakePoint(kAnchorPointX, kAnchorPointY)
- profile:profile()];
-
- [controller_ showWindow:nil];
- }
-
- // Checks that the controller's view contains at least one separator subview
- // and that it has full width.
- void EnsureSeparatorHasCorrectWidth() {
- bool found = false;
- for (id view in [[[controller_ window] contentView] subviews]) {
- // Assume all NSBox subviews are separators.
- if ([view isKindOfClass:[NSBox class]]) {
- found = true;
- ASSERT_EQ(NSWidth([[controller_ window] frame]),
- NSWidth([view bounds]));
- }
- }
- ASSERT_TRUE(found);
- }
-
- protected:
- ActionBoxMenuBubbleController* controller_;
- MenuDelegate menu_delegate_;
- ExtensionService* service_;
-};
-
-TEST_F(ActionBoxMenuBubbleControllerTest, CreateMenuWithExtensions) {
- scoped_ptr<ActionBoxMenuModel> model(new ActionBoxMenuModel(
- profile(), &menu_delegate_));
- AddPageLauncherExtension(model.get(), "Launch extension 1", 0);
- AddPageLauncherExtension(model.get(), "Launch extension 2", 1);
- CreateController(model.Pass());
-
- // Ensure extensions are there and in the right order.
- int extension1Index = -1;
- int extension2Index = -1;
- for (id actionBoxMenuItemController in [controller_ items]) {
- NSString* label = [[actionBoxMenuItemController nameField] stringValue];
- int index = [actionBoxMenuItemController modelIndex];
- NSImage* image = [[actionBoxMenuItemController iconView] image];
- if ([label isEqualToString:@"Launch extension 1"]) {
- ASSERT_EQ(-1, extension1Index);
- ASSERT_EQ(19, [image size].width);
- ASSERT_EQ(19, [image size].height);
- extension1Index = index;
- }
- if ([label isEqualToString:@"Launch extension 2"]) {
- ASSERT_EQ(-1, extension2Index);
- ASSERT_EQ(19, [image size].width);
- ASSERT_EQ(19, [image size].height);
- extension2Index = index;
- }
- }
-
- ASSERT_NE(-1, extension1Index);
- ASSERT_NE(-1, extension2Index);
- ASSERT_EQ(extension1Index, extension2Index - 1);
-}
-
-TEST_F(ActionBoxMenuBubbleControllerTest, CheckSeparatorWithShortExtensions) {
- scoped_ptr<ActionBoxMenuModel> model(new ActionBoxMenuModel(
- profile(), &menu_delegate_));
- model->AddItem(0, ASCIIToUTF16("Bookmark this page"));
- AddPageLauncherExtension(model.get(), "Short", 1);
- CreateController(model.Pass());
-
- // The width of the menu is dictated by the widest item which in this case
- // is going to be "Bookmark this page", which comes before the separator.
- // Ensure that, in this case, the separator has the full width.
- EnsureSeparatorHasCorrectWidth();
-}
-
-TEST_F(ActionBoxMenuBubbleControllerTest, CheckSeparatorWithLongExtensions) {
- scoped_ptr<ActionBoxMenuModel> model(new ActionBoxMenuModel(
- profile(), &menu_delegate_));
- model->AddItem(0, ASCIIToUTF16("Bookmark this page"));
- AddPageLauncherExtension(model.get(),
- "This is a long page launcher extension title...", 1);
- CreateController(model.Pass());
-
- // The width of the menu is dictated by the widest item which in this case
- // is going to be the extension, which comes after the separator. Ensure that,
- // in this case, the separator has the full width.
- EnsureSeparatorHasCorrectWidth();
-}
-
-} // namespace
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
index 69af462..d682305 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
@@ -28,7 +28,6 @@ class KeywordHintDecoration;
class LocationBarDecoration;
class LocationIconDecoration;
class PageActionDecoration;
-class PlusDecoration;
class Profile;
class SelectedKeywordDecoration;
class StarDecoration;
@@ -77,7 +76,6 @@ class LocationBarViewMac : public LocationBar,
virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE;
virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE;
virtual void TestPageActionPressed(size_t index) OVERRIDE;
- virtual void TestActionBoxMenuItemSelected(int command_id) OVERRIDE;
virtual bool GetBookmarkStarVisibility() OVERRIDE;
// Set/Get the editable state of the field.
@@ -87,10 +85,6 @@ class LocationBarViewMac : public LocationBar,
// Set the starred state of the bookmark star.
void SetStarred(bool starred);
- // Set (or resets) the icon image resource for the action box plus decoration.
- void ResetActionBoxIcon();
- void SetActionBoxIcon(int image_id);
-
// Happens when the zoom changes for the active tab. |can_show_bubble| is
// false when the change in zoom for the active tab wasn't an explicit user
// action (e.g. switching tabs, creating a new tab, creating a new browser).
@@ -102,10 +96,6 @@ class LocationBarViewMac : public LocationBar,
// aim at.
NSPoint GetBookmarkBubblePoint() const;
- // Get the point in window coordinates on the Action Box icon for
- // anchoring its bubbles.
- NSPoint GetActionBoxAnchorPoint() const;
-
// Get the point in window coordinates in the security icon at which the page
// info bubble aims.
NSPoint GetPageInfoBubblePoint() const;
@@ -211,9 +201,6 @@ class LocationBarViewMac : public LocationBar,
// Ensures the star decoration is visible or hidden, as required.
void UpdateStarDecorationVisibility();
- // Ensures the plus decoration is visible or hidden, as required.
- void UpdatePlusDecorationVisibility();
-
scoped_ptr<OmniboxViewMac> omnibox_view_;
CommandUpdater* command_updater_; // Weak, owned by Browser.
@@ -238,9 +225,6 @@ class LocationBarViewMac : public LocationBar,
// on the left.
scoped_ptr<EVBubbleDecoration> ev_bubble_decoration_;
- // Action "plus" button right of bookmark star.
- scoped_ptr<PlusDecoration> plus_decoration_;
-
// Bookmark star right of page actions.
scoped_ptr<StarDecoration> star_decoration_;
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index 690b16d..ec510a6 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -39,7 +39,6 @@
#import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h"
#import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h"
#import "chrome/browser/ui/cocoa/location_bar/page_action_decoration.h"
-#import "chrome/browser/ui/cocoa/location_bar/plus_decoration.h"
#import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h"
#import "chrome/browser/ui/cocoa/location_bar/star_decoration.h"
#import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h"
@@ -104,9 +103,6 @@ LocationBarViewMac::LocationBarViewMac(
content::PAGE_TRANSITION_TYPED |
content::PAGE_TRANSITION_FROM_ADDRESS_BAR)),
weak_ptr_factory_(this) {
- if (extensions::FeatureSwitch::action_box()->IsEnabled()) {
- plus_decoration_.reset(new PlusDecoration(this, browser_));
- }
for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
DCHECK_EQ(i, content_setting_decorations_.size());
@@ -238,7 +234,6 @@ void LocationBarViewMac::Update(const WebContents* contents,
command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE_FROM_STAR,
IsStarEnabled());
UpdateStarDecorationVisibility();
- UpdatePlusDecorationVisibility();
UpdateZoomDecoration();
RefreshPageActionDecorations();
RefreshContentSettingsDecorations();
@@ -467,11 +462,6 @@ void LocationBarViewMac::TestPageActionPressed(size_t index) {
page_action_decorations_[index]->OnMousePressed(NSZeroRect);
}
-void LocationBarViewMac::TestActionBoxMenuItemSelected(int command_id) {
- plus_decoration_->action_box_button_controller()->ExecuteCommand(
- command_id, 0);
-}
-
bool LocationBarViewMac::GetBookmarkStarVisibility() {
DCHECK(star_decoration_.get());
return star_decoration_->IsVisible();
@@ -480,7 +470,6 @@ bool LocationBarViewMac::GetBookmarkStarVisibility() {
void LocationBarViewMac::SetEditable(bool editable) {
[field_ setEditable:editable ? YES : NO];
UpdateStarDecorationVisibility();
- UpdatePlusDecorationVisibility();
UpdateZoomDecoration();
UpdatePageActions();
Layout();
@@ -504,16 +493,6 @@ void LocationBarViewMac::SetStarred(bool starred) {
OnDecorationsChanged();
}
-void LocationBarViewMac::ResetActionBoxIcon() {
- plus_decoration_->ResetIcon();
- OnDecorationsChanged();
-}
-
-void LocationBarViewMac::SetActionBoxIcon(int image_id) {
- plus_decoration_->SetTemporaryIcon(image_id);
- OnDecorationsChanged();
-}
-
void LocationBarViewMac::ZoomChangedForActiveTab(bool can_show_bubble) {
UpdateZoomDecoration();
OnDecorationsChanged();
@@ -522,10 +501,6 @@ void LocationBarViewMac::ZoomChangedForActiveTab(bool can_show_bubble) {
zoom_decoration_->ToggleBubble(YES);
}
-NSPoint LocationBarViewMac::GetActionBoxAnchorPoint() const {
- return plus_decoration_->GetActionBoxAnchorPoint();
-}
-
NSPoint LocationBarViewMac::GetBookmarkBubblePoint() const {
AutocompleteTextFieldCell* cell = [field_ cell];
const NSRect frame = [cell frameForDecoration:star_decoration_.get()
@@ -667,8 +642,6 @@ void LocationBarViewMac::Layout() {
[cell addLeftDecoration:location_icon_decoration_.get()];
[cell addLeftDecoration:selected_keyword_decoration_.get()];
[cell addLeftDecoration:ev_bubble_decoration_.get()];
- if (plus_decoration_.get())
- [cell addRightDecoration:plus_decoration_.get()];
[cell addRightDecoration:star_decoration_.get()];
[cell addRightDecoration:zoom_decoration_.get()];
@@ -749,17 +722,5 @@ void LocationBarViewMac::UpdateZoomDecoration() {
}
void LocationBarViewMac::UpdateStarDecorationVisibility() {
- // If the action box is enabled, only show the star if it's lit.
- bool visible = IsStarEnabled();
- if (!star_decoration_->starred() &&
- extensions::FeatureSwitch::action_box()->IsEnabled())
- visible = false;
- star_decoration_->SetVisible(visible);
-}
-
-void LocationBarViewMac::UpdatePlusDecorationVisibility() {
- if (extensions::FeatureSwitch::action_box()->IsEnabled()) {
- // If the action box is enabled, hide it when input is in progress.
- plus_decoration_->SetVisible(!toolbar_model_->GetInputInProgress());
- }
+ star_decoration_->SetVisible(IsStarEnabled());
}
diff --git a/chrome/browser/ui/cocoa/location_bar/plus_decoration.h b/chrome/browser/ui/cocoa/location_bar/plus_decoration.h
deleted file mode 100644
index 64bcf70..0000000
--- a/chrome/browser/ui/cocoa/location_bar/plus_decoration.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_PLUS_DECORATION_H_
-#define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_PLUS_DECORATION_H_
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/mac/scoped_nsobject.h"
-#include "chrome/browser/ui/cocoa/location_bar/button_decoration.h"
-#include "chrome/browser/ui/toolbar/action_box_button_controller.h"
-
-@class ActionBoxMenuBubbleController;
-class Browser;
-class LocationBarViewMac;
-
-// Note: this file is under development (see crbug.com/138118).
-
-// Plus icon on the right side of the location bar.
-class PlusDecoration : public ButtonDecoration,
- public ActionBoxButtonController::Delegate {
- public:
- PlusDecoration(LocationBarViewMac* owner, Browser* browser);
- virtual ~PlusDecoration();
-
- // Helper to get where the action box menu and bubble point should be
- // anchored. Similar to |PageActionDecoration| or |StarDecoration|.
- NSPoint GetActionBoxAnchorPoint();
-
- // Sets or clears a temporary icon for the button.
- void ResetIcon();
- void SetTemporaryIcon(int image_id);
-
- // Implement |LocationBarDecoration|.
- virtual bool AcceptsMousePress() OVERRIDE;
- virtual bool OnMousePressed(NSRect frame) OVERRIDE;
- virtual NSString* GetToolTip() OVERRIDE;
-
- ActionBoxButtonController* action_box_button_controller() {
- return &controller_;
- }
-
- private:
- // Implement |ActionBoxButtonController::Delegate|.
- virtual void ShowMenu(scoped_ptr<ActionBoxMenuModel> model) OVERRIDE;
-
- // Owner of the decoration, used to obtain the menu.
- LocationBarViewMac* owner_;
-
- Browser* browser_;
-
- ActionBoxButtonController controller_;
-
- void SetIcons(int normal_id, int hover_id, int pressed_id);
-
- base::scoped_nsobject<ActionBoxMenuBubbleController> menu_controller_;
-
- DISALLOW_COPY_AND_ASSIGN(PlusDecoration);
-};
-
-#endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_PLUS_DECORATION_H_
diff --git a/chrome/browser/ui/cocoa/location_bar/plus_decoration.mm b/chrome/browser/ui/cocoa/location_bar/plus_decoration.mm
deleted file mode 100644
index c8cb131..0000000
--- a/chrome/browser/ui/cocoa/location_bar/plus_decoration.mm
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/browser/ui/cocoa/location_bar/plus_decoration.h"
-
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_window.h"
-#import "chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.h"
-#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
-#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
-#import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
-#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util_mac.h"
-
-namespace {
-// The offset to apply to the menu so that it appears just attached to the
-// right-hand side of the omnibox while slightly overlapping vertically.
-const CGFloat kAnchorPointXOffset = 1.0;
-const CGFloat kAnchorPointYOffset = 2.0;
-} // namespace
-
-PlusDecoration::PlusDecoration(LocationBarViewMac* owner,
- Browser* browser)
- : owner_(owner),
- browser_(browser),
- controller_(browser, this) {
- SetVisible(true);
- ResetIcon();
-}
-
-PlusDecoration::~PlusDecoration() {
-}
-
-NSPoint PlusDecoration::GetActionBoxAnchorPoint() {
- AutocompleteTextField* field = owner_->GetAutocompleteTextField();
- NSRect bounds = [field bounds];
- NSPoint anchor = NSMakePoint(NSMaxX(bounds) - kAnchorPointXOffset,
- NSMaxY(bounds) - kAnchorPointYOffset);
- return [field convertPoint:anchor toView:nil];
-}
-
-void PlusDecoration::ResetIcon() {
- SetIcons(
- IDR_ACTION_BOX_BUTTON_NORMAL,
- IDR_ACTION_BOX_BUTTON_HOVER,
- IDR_ACTION_BOX_BUTTON_PRESSED);
-}
-
-void PlusDecoration::SetTemporaryIcon(int image_id) {
- SetIcons(image_id, image_id, image_id);
-}
-
-bool PlusDecoration::AcceptsMousePress() {
- return true;
-}
-
-bool PlusDecoration::OnMousePressed(NSRect frame) {
- controller_.OnButtonClicked();
- return true;
-}
-
-NSString* PlusDecoration::GetToolTip() {
- return l10n_util::GetNSStringWithFixup(IDS_TOOLTIP_ACTION_BOX_BUTTON);
-}
-
-void PlusDecoration::ShowMenu(scoped_ptr<ActionBoxMenuModel> menu_model) {
- // Controller for the menu attached to the plus decoration.
- // |menu_controller| will automatically release itself on close.
- NSWindow* parent = browser_->window()->GetNativeWindow();
- ActionBoxMenuBubbleController* menu_controller =
- [[ActionBoxMenuBubbleController alloc]
- initWithModel:menu_model.Pass()
- parentWindow:parent
- anchoredAt:[parent convertBaseToScreen:GetActionBoxAnchorPoint()]
- profile:browser_->profile()];
-
- [menu_controller showWindow:nil];
-}
-
-void PlusDecoration::SetIcons(int normal_id, int hover_id, int pressed_id) {
- SetNormalImage(OmniboxViewMac::ImageForResource(normal_id));
- SetHoverImage(OmniboxViewMac::ImageForResource(hover_id));
- SetPressedImage(OmniboxViewMac::ImageForResource(pressed_id));
-}
diff --git a/chrome/browser/ui/gtk/action_box_button_gtk.cc b/chrome/browser/ui/gtk/action_box_button_gtk.cc
deleted file mode 100644
index cd87e8a..0000000
--- a/chrome/browser/ui/gtk/action_box_button_gtk.cc
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/gtk/action_box_button_gtk.h"
-
-#include <gtk/gtk.h>
-
-#include "base/logging.h"
-#include "chrome/browser/extensions/extension_icon_image.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/gtk/custom_button.h"
-#include "chrome/browser/ui/gtk/view_id_util.h"
-#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
-#include "chrome/browser/ui/view_ids.h"
-#include "chrome/common/extensions/api/extension_action/action_info.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_constants.h"
-#include "chrome/common/extensions/manifest_handlers/icons_handler.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/layout.h"
-#include "ui/gfx/gtk_util.h"
-#include "ui/gfx/image/image_skia.h"
-#include "ui/gfx/image/image_skia_rep.h"
-
-using extensions::ActionInfo;
-using extensions::Extension;
-using extensions::IconImage;
-
-namespace {
-
-// This class provides a GtkWidget that shows an Extension's page launcher icon.
-// We can't use GtkImage directly because loading the icon from the extension
-// must be done asynchronously. The lifetime of this object is tied to its
-// GtkWidget, and it will delete itself upon receiving a "destroy" signal from
-// the widget.
-class ExtensionIcon : public IconImage::Observer {
- public:
- ExtensionIcon(Profile* profile, const Extension* extension);
-
- GtkWidget* GetWidget();
-
- private:
- virtual ~ExtensionIcon() {}
-
- virtual void OnExtensionIconImageChanged(IconImage* image) OVERRIDE;
- void UpdateIcon();
-
- CHROMEGTK_CALLBACK_0(ExtensionIcon, void, OnDestroyed);
-
- GtkWidget* image_;
-
- scoped_ptr<IconImage> icon_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionIcon);
-};
-
-ExtensionIcon::ExtensionIcon(Profile* profile, const Extension* extension)
- : image_(NULL) {
- const ActionInfo* page_launcher_info =
- ActionInfo::GetPageLauncherInfo(extension);
- icon_.reset(new IconImage(profile,
- extension,
- page_launcher_info->default_icon,
- extension_misc::EXTENSION_ICON_ACTION,
- extensions::IconsInfo::GetDefaultAppIcon(),
- this));
- UpdateIcon();
-}
-
-GtkWidget* ExtensionIcon::GetWidget() {
- return image_;
-}
-
-void ExtensionIcon::OnExtensionIconImageChanged(IconImage* image) {
- DCHECK_EQ(image, icon_.get());
- UpdateIcon();
-}
-
-void ExtensionIcon::UpdateIcon() {
- const gfx::ImageSkiaRep& rep =
- icon_->image_skia().GetRepresentation(ui::SCALE_FACTOR_NONE);
- GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(rep.sk_bitmap());
-
- if (!image_) {
- image_ = gtk_image_new_from_pixbuf(pixbuf);
- g_signal_connect(image_, "destroy", G_CALLBACK(OnDestroyedThunk), this);
- } else {
- gtk_image_set_from_pixbuf(GTK_IMAGE(image_), pixbuf);
- }
- g_object_unref(pixbuf);
-}
-
-void ExtensionIcon::OnDestroyed(GtkWidget* sender) {
- DCHECK_EQ(sender, image_);
- delete this;
-}
-
-} // namespace
-
-ActionBoxButtonGtk::ActionBoxButtonGtk(Browser* browser)
- : controller_(browser, this),
- browser_(browser) {
- button_.reset(new CustomDrawButton(
- IDR_ACTION_BOX_BUTTON_NORMAL,
- IDR_ACTION_BOX_BUTTON_PRESSED,
- IDR_ACTION_BOX_BUTTON_HOVER,
- 0)); // TODO: disabled?
- gtk_widget_set_tooltip_text(widget(),
- l10n_util::GetStringUTF8(IDS_TOOLTIP_ACTION_BOX_BUTTON).c_str());
-
- g_signal_connect(widget(), "button-press-event",
- G_CALLBACK(OnButtonPressThunk), this);
-
- ViewIDUtil::SetID(widget(), VIEW_ID_ACTION_BOX_BUTTON);
-}
-
-ActionBoxButtonGtk::~ActionBoxButtonGtk() {
-}
-
-void ActionBoxButtonGtk:: StoppedShowing() {
- button_->UnsetPaintOverride();
-}
-
-bool ActionBoxButtonGtk::AlwaysShowIconForCmd(int command_id) const {
- return true;
-}
-
-GtkWidget* ActionBoxButtonGtk::GetImageForCommandId(int command_id) const {
- int index = model_->GetIndexOfCommandId(command_id);
- if (model_->IsItemExtension(index)) {
- const Extension* extension = model_->GetExtensionAt(index);
- return (new ExtensionIcon(browser_->profile(), extension))->GetWidget();
- }
-
- return GetDefaultImageForCommandId(command_id);
-}
-
-GtkWidget* ActionBoxButtonGtk::widget() {
- return button_->widget();
-}
-
-void ActionBoxButtonGtk::ShowMenu(scoped_ptr<ActionBoxMenuModel> model) {
- button_->SetPaintOverride(GTK_STATE_ACTIVE);
- model_ = model.Pass();
- menu_.reset(new MenuGtk(this, model_.get()));
- menu_->PopupForWidget(
- button_->widget(),
- // The mouse button. This is 1 because currently it can only be generated
- // from a mouse click, but if ShowMenu can be called in other situations
- // (e.g. other mouse buttons, or without any click at all) then it will
- // need to be that button or 0.
- 1,
- gtk_get_current_event_time());
-}
-
-gboolean ActionBoxButtonGtk::OnButtonPress(GtkWidget* widget,
- GdkEventButton* event) {
- if (event->button == 1)
- controller_.OnButtonClicked();
- return FALSE;
-}
diff --git a/chrome/browser/ui/gtk/action_box_button_gtk.h b/chrome/browser/ui/gtk/action_box_button_gtk.h
deleted file mode 100644
index 423b0cb..0000000
--- a/chrome/browser/ui/gtk/action_box_button_gtk.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_GTK_ACTION_BOX_BUTTON_GTK_H_
-#define CHROME_BROWSER_UI_GTK_ACTION_BOX_BUTTON_GTK_H_
-
-#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/ui/gtk/menu_gtk.h"
-#include "chrome/browser/ui/toolbar/action_box_button_controller.h"
-#include "ui/base/gtk/gtk_signal.h"
-
-class ActionBoxMenuModel;
-class Browser;
-class CustomDrawButton;
-
-typedef struct _GtkWidget GtkWidget;
-
-// This class displays the action box button with an associated menu. This is
-// where extension actions and the bookmark star live.
-class ActionBoxButtonGtk : public MenuGtk::Delegate,
- public ActionBoxButtonController::Delegate {
- public:
- explicit ActionBoxButtonGtk(Browser* browser);
- virtual ~ActionBoxButtonGtk();
-
- // MenuGtk::Delegate implementation.
- virtual void StoppedShowing() OVERRIDE;
- virtual bool AlwaysShowIconForCmd(int command_id) const OVERRIDE;
- virtual GtkWidget* GetImageForCommandId(int command_id) const OVERRIDE;
-
- GtkWidget* widget();
-
- ActionBoxButtonController* action_box_button_controller() {
- return &controller_;
- }
-
- private:
- // ActionBoxButtonController::Delegate implementation.
- virtual void ShowMenu(scoped_ptr<ActionBoxMenuModel> model) OVERRIDE;
-
- // Show the action box menu.
- CHROMEGTK_CALLBACK_1(ActionBoxButtonGtk, gboolean, OnButtonPress,
- GdkEventButton*);
-
- ActionBoxButtonController controller_;
-
- scoped_ptr<CustomDrawButton> button_;
-
- // The browser to which we will send commands.
- Browser* browser_;
-
- // The model and menu displayed when the button is clicked. The menu is
- // recreated every time it is displayed.
- scoped_ptr<ActionBoxMenuModel> model_;
- scoped_ptr<MenuGtk> menu_;
-
- DISALLOW_COPY_AND_ASSIGN(ActionBoxButtonGtk);
-};
-
-#endif // CHROME_BROWSER_UI_GTK_ACTION_BOX_BUTTON_GTK_H_
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
index 3f9e6cf..13adaa0 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -47,7 +47,6 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
#include "chrome/browser/ui/content_settings/content_setting_image_model.h"
-#include "chrome/browser/ui/gtk/action_box_button_gtk.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
@@ -487,19 +486,6 @@ void LocationBarViewGtk::Init(bool popup_window_mode) {
// doesn't work, someone is probably calling show_all on our parent box.
gtk_box_pack_end(GTK_BOX(entry_box_), tab_to_search_hint_, FALSE, FALSE, 0);
- if (extensions::FeatureSwitch::action_box()->IsEnabled()) {
- // TODO(mpcomplete): should we hide this if ShouldOnlyShowLocation()==true?
- action_box_button_.reset(new ActionBoxButtonGtk(browser_));
-
- GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1);
- gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),
- 0, 0, 0, InnerPadding());
- gtk_container_add(GTK_CONTAINER(alignment), action_box_button_->widget());
-
- gtk_box_pack_end(GTK_BOX(hbox_.get()), alignment,
- FALSE, FALSE, 0);
- }
-
if (browser_defaults::bookmarks_enabled && !ShouldOnlyShowLocation()) {
// Hide the star icon in popups, app windows, etc.
CreateStarButton();
@@ -1029,11 +1015,6 @@ void LocationBarViewGtk::TestPageActionPressed(size_t index) {
page_action_views_[index]->TestActivatePageAction();
}
-void LocationBarViewGtk::TestActionBoxMenuItemSelected(int command_id) {
- action_box_button_->action_box_button_controller()->
- ExecuteCommand(command_id, 0);
-}
-
bool LocationBarViewGtk::GetBookmarkStarVisibility() {
return starred_;
}
@@ -1622,9 +1603,6 @@ void LocationBarViewGtk::UpdateStarIcon() {
command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE_FROM_STAR,
star_enabled);
- if (extensions::FeatureSwitch::action_box()->IsEnabled() && !starred_) {
- star_enabled = false;
- }
if (star_enabled) {
gtk_widget_show_all(star_.get());
int id = starred_ ? IDR_STAR_LIT : IDR_STAR;
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h
index c046b53..c886f32 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h
@@ -36,7 +36,6 @@
#include "ui/base/window_open_disposition.h"
#include "url/gurl.h"
-class ActionBoxButtonGtk;
class Browser;
class CommandUpdater;
class ContentSettingImageModel;
@@ -150,7 +149,6 @@ class LocationBarViewGtk : public OmniboxEditController,
virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE;
virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE;
virtual void TestPageActionPressed(size_t index) OVERRIDE;
- virtual void TestActionBoxMenuItemSelected(int command_id) OVERRIDE;
virtual bool GetBookmarkStarVisibility() OVERRIDE;
// content::NotificationObserver:
@@ -484,8 +482,6 @@ class LocationBarViewGtk : public OmniboxEditController,
// Alignment used to wrap |location_entry_|.
GtkWidget* location_entry_alignment_;
- scoped_ptr<ActionBoxButtonGtk> action_box_button_;
-
CommandUpdater* command_updater_;
ToolbarModel* toolbar_model_;
Browser* browser_;
diff --git a/chrome/browser/ui/omnibox/action_box_browsertest.cc b/chrome/browser/ui/omnibox/action_box_browsertest.cc
deleted file mode 100644
index 869a641..0000000
--- a/chrome/browser/ui/omnibox/action_box_browsertest.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/command_line.h"
-#include "base/message_loop/message_loop.h"
-#include "base/strings/string16.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/bookmarks/bookmark_model.h"
-#include "chrome/browser/bookmarks/bookmark_model_factory.h"
-#include "chrome/browser/bookmarks/bookmark_utils.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_commands.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/omnibox/location_bar.h"
-#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/url_constants.h"
-#include "chrome/test/base/in_process_browser_test.h"
-#include "chrome/test/base/interactive_test_utils.h"
-#include "chrome/test/base/testing_profile.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/web_contents.h"
-
-class ActionBoxTest : public InProcessBrowserTest,
- public content::NotificationObserver {
- protected:
- ActionBoxTest() {}
-
- virtual void SetUpOnMainThread() OVERRIDE {
- ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
- ASSERT_NO_FATAL_FAILURE(SetupComponents());
- chrome::FocusLocationBar(browser());
- ASSERT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX));
- }
-
- virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
- // Enable Action Box UI for the test.
- command_line->AppendSwitchASCII(switches::kActionBox, "1");
- }
-
- void SetupComponents() {}
-
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE {
- switch (type) {
- case content::NOTIFICATION_WEB_CONTENTS_DESTROYED:
- case chrome::NOTIFICATION_TAB_PARENTED:
- case chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY:
- case chrome::NOTIFICATION_HISTORY_LOADED:
- case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED:
- case chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED:
- break;
- default:
- FAIL() << "Unexpected notification type";
- }
- base::MessageLoop::current()->Quit();
- }
-
- DISALLOW_COPY_AND_ASSIGN(ActionBoxTest);
-};
-
-// Test if Bookmark star appears after bookmarking a page in the action box, and
-// disappears after unbookmarking a page.
-IN_PROC_BROWSER_TEST_F(ActionBoxTest, BookmarkAPageTest) {
- LocationBarTesting* loc_bar =
- browser()->window()->GetLocationBar()->GetLocationBarForTesting();
-
- // Navigate somewhere we can bookmark.
- ui_test_utils::NavigateToURL(browser(), GURL("http://www.google.com"));
-
- // Make sure the bookmarking system is up and running.
- BookmarkModel* model =
- BookmarkModelFactory::GetForProfile(browser()->profile());
- ui_test_utils::WaitForBookmarkModelToLoad(model);
-
- // Page is not bookmarked yet.
- ASSERT_FALSE(loc_bar->GetBookmarkStarVisibility());
-
- // Simulate an action box click and menu item selection.
- chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE_FROM_STAR);
-
- // Page is now bookmarked.
- ASSERT_TRUE(loc_bar->GetBookmarkStarVisibility());
-
- // Get the BookmarkModel to unbookmark the bookmark.
- bookmark_utils::RemoveAllBookmarks(model, GURL("http://www.google.com"));
-
- // Page is now unbookmarked.
- ASSERT_FALSE(loc_bar->GetBookmarkStarVisibility());
-
-}
diff --git a/chrome/browser/ui/omnibox/location_bar.h b/chrome/browser/ui/omnibox/location_bar.h
index eeeb843..6a759b1 100644
--- a/chrome/browser/ui/omnibox/location_bar.h
+++ b/chrome/browser/ui/omnibox/location_bar.h
@@ -104,10 +104,6 @@ class LocationBarTesting {
// Simulates a left mouse pressed on the visible page action at |index|.
virtual void TestPageActionPressed(size_t index) = 0;
- // Simulates a left mouse pressed on the action box decoration, followed by
- // a menu item selection.
- virtual void TestActionBoxMenuItemSelected(int command_id) = 0;
-
// Returns whether or not the bookmark star decoration is visible.
virtual bool GetBookmarkStarVisibility() = 0;
diff --git a/chrome/browser/ui/toolbar/action_box_button_controller.cc b/chrome/browser/ui/toolbar/action_box_button_controller.cc
deleted file mode 100644
index 253756c..0000000
--- a/chrome/browser/ui/toolbar/action_box_button_controller.cc
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/toolbar/action_box_button_controller.h"
-
-#include "base/logging.h"
-#include "base/metrics/histogram.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/extensions/api/page_launcher/page_launcher_api.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_commands.h"
-#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
-#include "chrome/common/extensions/api/extension_action/action_info.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_set.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_source.h"
-#include "content/public/browser/render_widget_host_view.h"
-#include "content/public/browser/user_metrics.h"
-#include "content/public/browser/web_contents.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/resource/resource_bundle.h"
-
-
-using content::UserMetricsAction;
-using content::WebContents;
-using extensions::ActionInfo;
-
-void ActionBoxButtonController::Delegate::ShowMenu(
- scoped_ptr<ActionBoxMenuModel> menu_model) {
-}
-
-ActionBoxButtonController::ActionBoxButtonController(Browser* browser,
- Delegate* delegate)
- : browser_(browser),
- delegate_(delegate),
- next_command_id_(0) {
- DCHECK(browser_);
- DCHECK(delegate_);
- registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_UNLOADED,
- content::Source<Profile>(browser->profile()));
-}
-
-ActionBoxButtonController::~ActionBoxButtonController() {}
-
-scoped_ptr<ActionBoxMenuModel> ActionBoxButtonController::CreateMenuModel() {
- // Build a menu model and display the menu.
- scoped_ptr<ActionBoxMenuModel> menu_model(
- new ActionBoxMenuModel(browser_->profile(), this));
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
-
- // In some unit tests, GetActiveWebContents can return NULL.
- bool starred = browser_->tab_strip_model()->GetActiveWebContents() &&
- BookmarkTabHelper::FromWebContents(browser_->tab_strip_model()->
- GetActiveWebContents())->is_starred();
- menu_model->AddItemWithStringId(
- IDC_BOOKMARK_PAGE_FROM_STAR,
- starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR);
- menu_model->SetIcon(
- menu_model->GetIndexOfCommandId(IDC_BOOKMARK_PAGE_FROM_STAR),
- rb.GetNativeImageNamed(starred ? IDR_STAR_LIT : IDR_STAR));
-
- ExtensionService* extension_service =
- extensions::ExtensionSystem::Get(browser_->profile())->
- extension_service();
- if (extension_service) {
- const ExtensionSet* extensions = extension_service->extensions();
- for (ExtensionSet::const_iterator it = extensions->begin();
- it != extensions->end(); ++it) {
- const extensions::Extension* extension = it->get();
- if (ActionInfo::GetPageLauncherInfo(extension)) {
- int command_id = GetCommandIdForExtension(*extension);
- menu_model->AddExtension(*extension, command_id);
- }
- }
- }
- return menu_model.Pass();
-}
-
-void ActionBoxButtonController::OnButtonClicked() {
- content::RecordAction(UserMetricsAction("ActionBox.ClickButton"));
- delegate_->ShowMenu(CreateMenuModel());
-}
-
-bool ActionBoxButtonController::IsCommandIdChecked(int command_id) const {
- return false;
-}
-
-bool ActionBoxButtonController::IsCommandIdEnabled(int command_id) const {
- return true;
-}
-
-bool ActionBoxButtonController::GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) {
- return false;
-}
-
-void ActionBoxButtonController::ExecuteCommand(int command_id,
- int event_flags) {
- // If the command id belongs to an extension, dispatch an onClicked event
- // to its pageLauncher.
- ExtensionIdCommandMap::const_iterator it =
- extension_command_ids_.find(command_id);
- if (it != extension_command_ids_.end()) {
- WebContents* web_contents =
- browser_->tab_strip_model()->GetActiveWebContents();
-
- std::string page_title = UTF16ToUTF8(web_contents->GetTitle());
- std::string selected_text =
- UTF16ToUTF8(web_contents->GetRenderWidgetHostView()->GetSelectedText());
- extensions::PageLauncherAPI::DispatchOnClickedEvent(
- browser_->profile(),
- it->second,
- web_contents->GetURL(),
- web_contents->GetContentsMimeType(),
- page_title.empty() ? NULL : &page_title,
- selected_text.empty() ? NULL : &selected_text);
- return;
- }
-
- // Otherwise, let the browser handle the command.
- chrome::ExecuteCommand(browser_, command_id);
-}
-
-int ActionBoxButtonController::GetCommandIdForExtension(
- const extensions::Extension& extension) {
- for (ExtensionIdCommandMap::const_iterator it =
- extension_command_ids_.begin();
- it != extension_command_ids_.end(); ++it) {
- if (it->second == extension.id())
- return it->first;
- }
-
- int command_id = GetNextCommandId();
- extension_command_ids_[command_id] = extension.id();
-
- return command_id;
-}
-
-int ActionBoxButtonController::GetNextCommandId() {
- int command_id = next_command_id_;
- // Find an available command id to return next time the function is called.
- do {
- next_command_id_++;
- // Larger command ids are reserved for non-dynamic entries, so we start
- // reusing old ids at this point.
- if (next_command_id_ >= IDC_MinimumLabelValue)
- next_command_id_ = 0;
- } while (extension_command_ids_.find(next_command_id_) !=
- extension_command_ids_.end());
-
- return command_id;
-}
-
-void ActionBoxButtonController::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_UNLOADED);
- const extensions::Extension* extension =
- content::Details<extensions::UnloadedExtensionInfo>(details)->extension;
-
- // Remove any entry point command ids associated with the extension.
- for (ExtensionIdCommandMap::iterator it = extension_command_ids_.begin();
- it != extension_command_ids_.end();) {
- if (it->second== extension->id())
- extension_command_ids_.erase(it++);
- else
- ++it;
- }
- // TODO(kalman): if there's a menu open, remove it from that too.
- // We may also want to listen to EXTENSION_LOADED to do the opposite.
-}
diff --git a/chrome/browser/ui/toolbar/action_box_button_controller.h b/chrome/browser/ui/toolbar/action_box_button_controller.h
deleted file mode 100644
index f61af21..0000000
--- a/chrome/browser/ui/toolbar/action_box_button_controller.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_BUTTON_CONTROLLER_H_
-#define CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_BUTTON_CONTROLLER_H_
-
-#include <map>
-#include <string>
-
-#include "base/memory/scoped_ptr.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-#include "ui/base/models/simple_menu_model.h"
-
-class ActionBoxMenuModel;
-class Browser;
-
-namespace extensions {
-class Extension;
-}
-
-namespace ui {
-class MenuModel;
-}
-
-// Controller for the action box.
-//
-// This should have the same lifetime as the action box itself -- that is, more
-// or less the lifetime of the tab -- unlike ActionBoxMenuModel which is scoped
-// to the menu being open.
-class ActionBoxButtonController : public ui::SimpleMenuModel::Delegate,
- public content::NotificationObserver {
- public:
- class Delegate {
- public:
- // Shows the menu with the given |menu_model|.
- virtual void ShowMenu(scoped_ptr<ActionBoxMenuModel> menu_model);
-
- protected:
- virtual ~Delegate() {}
- };
-
- ActionBoxButtonController(Browser* browser, Delegate* delegate);
- virtual ~ActionBoxButtonController();
-
- // Creates and populates an ActionBoxMenuModel according to the current
- // state of the browser.
- scoped_ptr<ActionBoxMenuModel> CreateMenuModel();
-
- // Notifies this that the action box button has been clicked.
- // Methods on the Delegate may be called re-entrantly.
- void OnButtonClicked();
-
- // Overridden from ui::SimpleMenuModel::Delegate:
- virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
- virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
- virtual bool GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) OVERRIDE;
- virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
-
- private:
- // Gets the command ID for an extension, creating a new one if necessary.
- int GetCommandIdForExtension(const extensions::Extension& extension);
-
- // Returns the next command ID to be used.
- int GetNextCommandId();
-
- // content::NotificationObserver implementation.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- Browser* browser_;
-
- Delegate* delegate_;
-
- typedef std::map<int, std::string> ExtensionIdCommandMap;
- ExtensionIdCommandMap extension_command_ids_;
-
- // The command ID to assign to the next dynamic entry that needs one.
- int next_command_id_;
-
- content::NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(ActionBoxButtonController);
-};
-
-#endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_BUTTON_CONTROLLER_H_
diff --git a/chrome/browser/ui/toolbar/action_box_context_menu_controller.cc b/chrome/browser/ui/toolbar/action_box_context_menu_controller.cc
deleted file mode 100644
index 4978c3a..0000000
--- a/chrome/browser/ui/toolbar/action_box_context_menu_controller.cc
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/toolbar/action_box_context_menu_controller.h"
-
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/extensions/extension_uninstall_dialog.h"
-#include "chrome/browser/extensions/management_policy.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/chrome_pages.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/manifest_url_handler.h"
-#include "content/public/browser/page_navigator.h"
-#include "content/public/common/page_transition_types.h"
-#include "content/public/common/referrer.h"
-#include "grit/chromium_strings.h"
-#include "grit/generated_resources.h"
-#include "ui/base/models/menu_separator_types.h"
-#include "ui/base/window_open_disposition.h"
-#include "url/gurl.h"
-
-using extensions::Extension;
-
-namespace {
-
-// Takes care of running the uninstall extension dialog. This class deletes
-// itself after the user has responded to the dialog.
-class ExtensionUninstaller : public ExtensionUninstallDialog::Delegate {
- public:
- ExtensionUninstaller(Browser* browser, Profile* profile);
-
- void ShowDialog(const Extension* extension);
-
- // ExtensionUninstallDialog::Delegate:
- virtual void ExtensionUninstallAccepted() OVERRIDE;
- virtual void ExtensionUninstallCanceled() OVERRIDE;
-
- private:
- virtual ~ExtensionUninstaller();
-
- scoped_ptr<ExtensionUninstallDialog> dialog_;
- std::string extension_id_;
- Profile* profile_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionUninstaller);
-};
-
-ExtensionUninstaller::ExtensionUninstaller(Browser* browser, Profile* profile)
- : dialog_(ExtensionUninstallDialog::Create(profile,
- browser,
- this)),
- profile_(profile) {
-}
-
-ExtensionUninstaller::~ExtensionUninstaller() {
-}
-
-void ExtensionUninstaller::ShowDialog(const Extension* extension) {
- extension_id_ = extension->id();
- dialog_->ConfirmUninstall(extension);
-}
-
-void ExtensionUninstaller::ExtensionUninstallAccepted() {
- ExtensionService* extension_service =
- extensions::ExtensionSystem::Get(profile_)->extension_service();
- if (extension_service->GetInstalledExtension(extension_id_))
- extension_service->UninstallExtension(extension_id_, false, NULL);
- delete this;
-}
-
-void ExtensionUninstaller::ExtensionUninstallCanceled() {
- delete this;
-}
-
-} // namespace
-
-ActionBoxContextMenuController::ActionBoxContextMenuController(
- Browser* browser,
- const Extension* extension)
- : browser_(browser),
- extension_id_(extension->id()),
- menu_model_(this) {
- std::string extension_name = extension->name();
- // Ampersands need to be escaped to avoid being treated like
- // mnemonics in the menu.
- ReplaceChars(extension_name, "&", "&&", &extension_name);
- menu_model_.AddItem(IDC_ACTION_BOX_EXTENSION_HOMEPAGE,
- UTF8ToUTF16(extension_name));
- menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
- menu_model_.AddItemWithStringId(IDC_ACTION_BOX_EXTENSION_MANAGE,
- IDS_MANAGE_EXTENSION);
- menu_model_.AddItemWithStringId(IDC_ACTION_BOX_EXTENSION_UNINSTALL,
- IDS_EXTENSIONS_UNINSTALL);
-}
-
-ActionBoxContextMenuController::~ActionBoxContextMenuController() {
-}
-
-bool ActionBoxContextMenuController::IsCommandIdChecked(int command_id) const {
- return false;
-}
-
-bool ActionBoxContextMenuController::IsCommandIdEnabled(int command_id) const {
- const Extension* extension = GetExtension();
- if (!extension)
- return false;
-
- switch (command_id) {
- case IDC_ACTION_BOX_EXTENSION_HOMEPAGE:
- return extensions::ManifestURL::GetHomepageURL(extension).is_valid();
- case IDC_ACTION_BOX_EXTENSION_MANAGE:
- return true;
- case IDC_ACTION_BOX_EXTENSION_UNINSTALL: {
- return extensions::ExtensionSystem::Get(browser_->profile())->
- management_policy()->UserMayModifySettings(extension, NULL);
- }
- default: {
- NOTREACHED();
- return false;
- }
- }
-}
-
-bool ActionBoxContextMenuController::GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) {
- return false;
-}
-
-void ActionBoxContextMenuController::ExecuteCommand(int command_id,
- int event_flags) {
- const Extension* extension = GetExtension();
- if (!extension)
- return;
-
- switch (command_id) {
- case IDC_ACTION_BOX_EXTENSION_HOMEPAGE: {
- content::OpenURLParams params(
- extensions::ManifestURL::GetHomepageURL(extension),
- content::Referrer(), NEW_FOREGROUND_TAB,
- content::PAGE_TRANSITION_LINK, false);
- browser_->OpenURL(params);
- break;
- }
- case IDC_ACTION_BOX_EXTENSION_MANAGE: {
- chrome::ShowExtensions(browser_, extension->id());
- break;
- }
- case IDC_ACTION_BOX_EXTENSION_UNINSTALL: {
- ExtensionUninstaller* uninstaller =
- new ExtensionUninstaller(browser_, browser_->profile());
- uninstaller->ShowDialog(extension);
- break;
- }
- default:
- NOTREACHED();
- }
-}
-
-const Extension* ActionBoxContextMenuController::GetExtension() const {
- ExtensionService* extension_service =
- extensions::ExtensionSystem::Get(browser_->profile())->
- extension_service();
- return extension_service->GetInstalledExtension(extension_id_);
-}
diff --git a/chrome/browser/ui/toolbar/action_box_context_menu_controller.h b/chrome/browser/ui/toolbar/action_box_context_menu_controller.h
deleted file mode 100644
index 92cf0e7..0000000
--- a/chrome/browser/ui/toolbar/action_box_context_menu_controller.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_CONTEXT_MENU_CONTROLLER_H__
-#define CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_CONTEXT_MENU_CONTROLLER_H__
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "ui/base/models/simple_menu_model.h"
-
-class Browser;
-
-namespace extensions {
-class Extension;
-} // namespace extensions
-
-namespace ui {
-class Accelerator;
-class MenuModel;
-} // namespace ui
-
-// This class handles building a context menu for extensions in the action
-// box. It also contains the logic necessary for executing the actions
-// associated with each menu entry.
-class ActionBoxContextMenuController : public ui::SimpleMenuModel::Delegate {
- public:
- // |browser| and |extension| must not be NULL.
- ActionBoxContextMenuController(Browser* browser,
- const extensions::Extension* extension);
- virtual ~ActionBoxContextMenuController();
-
- ui::MenuModel* menu_model() { return &menu_model_; }
-
- // ui::SimpleMenuModel::Delegate:
- virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
- virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
- virtual bool GetAcceleratorForCommandId(
- int command_id,
- ui::Accelerator* accelerator) OVERRIDE;
- virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
-
- private:
- const extensions::Extension* GetExtension() const;
-
- Browser* browser_;
- std::string extension_id_;
- ui::SimpleMenuModel menu_model_;
-
- DISALLOW_COPY_AND_ASSIGN(ActionBoxContextMenuController);
-};
-
-#endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_CONTEXT_MENU_CONTROLLER_H__
diff --git a/chrome/browser/ui/toolbar/action_box_menu_model.cc b/chrome/browser/ui/toolbar/action_box_menu_model.cc
deleted file mode 100644
index 9a5197a..0000000
--- a/chrome/browser/ui/toolbar/action_box_menu_model.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
-
-#include "base/logging.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/extensions/extension_toolbar_model.h"
-#include "chrome/common/extensions/api/extension_action/action_info.h"
-
-
-using extensions::ActionInfo;
-
-////////////////////////////////////////////////////////////////////////////////
-// ActionBoxMenuModel
-
-ActionBoxMenuModel::ActionBoxMenuModel(Profile* profile,
- ui::SimpleMenuModel::Delegate* delegate)
- : ui::SimpleMenuModel(delegate),
- profile_(profile) {
-
-}
-
-ActionBoxMenuModel::~ActionBoxMenuModel() {
-}
-
-void ActionBoxMenuModel::AddExtension(const extensions::Extension& extension,
- int command_id) {
- if (extension_ids_.empty())
- AddSeparator(ui::NORMAL_SEPARATOR);
- extension_ids_.push_back(extension.id());
- const ActionInfo* page_launcher_info =
- ActionInfo::GetPageLauncherInfo(&extension);
- DCHECK(page_launcher_info);
- AddItem(command_id, UTF8ToUTF16(page_launcher_info->default_title));
-}
-
-bool ActionBoxMenuModel::IsItemExtension(int index) {
- // The extensions are always at the end of the model.
- CHECK(index < GetItemCount());
- return index >= GetFirstExtensionIndex();
-}
-
-const extensions::Extension* ActionBoxMenuModel::GetExtensionAt(int index) {
- if (!IsItemExtension(index))
- return NULL;
-
- int index_in_extension_ids = index - GetFirstExtensionIndex();
- CHECK_GE(index_in_extension_ids, 0);
- CHECK_LT(index_in_extension_ids, static_cast<int>(extension_ids_.size()));
-
- ExtensionService* extension_service =
- extensions::ExtensionSystem::Get(profile_)->extension_service();
- return extension_service->extensions()->GetByID(
- extension_ids_[index_in_extension_ids]);
-}
-
-void ActionBoxMenuModel::ExecuteCommand(int command_id) {
- delegate()->ExecuteCommand(command_id, 0);
-}
-
-int ActionBoxMenuModel::GetFirstExtensionIndex() {
- return GetItemCount() - extension_ids_.size();
-}
diff --git a/chrome/browser/ui/toolbar/action_box_menu_model.h b/chrome/browser/ui/toolbar/action_box_menu_model.h
deleted file mode 100644
index 02c21a8..0000000
--- a/chrome/browser/ui/toolbar/action_box_menu_model.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_
-#define CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_
-
-#include <map>
-
-#include "chrome/common/extensions/extension.h"
-#include "content/public/browser/notification_observer.h"
-#include "ui/base/models/simple_menu_model.h"
-
-class Profile;
-
-// A menu model that builds the contents of the action box menu. Effectively,
-// a ui::SimpleMenuModel with methods specifically for dealing with extension
-// content.
-//
-// This model should be built on demand since its content reflects the state of
-// the browser at creation time.
-class ActionBoxMenuModel : public ui::SimpleMenuModel {
- public:
- ActionBoxMenuModel(Profile* profile, ui::SimpleMenuModel::Delegate* delegate);
- virtual ~ActionBoxMenuModel();
-
- // Adds an extension to the model with a given command ID.
- void AddExtension(const extensions::Extension& extension, int command_id);
-
- // Returns true if item associated with an extension.
- bool IsItemExtension(int index);
-
- // Returns an extension associated with model item at |index|
- // or NULL if it is not an extension item.
- const extensions::Extension* GetExtensionAt(int index);
-
- // Calls ExecuteCommand on the delegate.
- void ExecuteCommand(int command_id);
-
- private:
- friend class ActionBoxMenuModelTest;
- // Gets the index of the first extension. This may be equal to the number of
- // total items in the model if there are no extensions installed.
- int GetFirstExtensionIndex();
-
- Profile* profile_;
-
- // The list of extensions added to the menu, in order, if any.
- extensions::ExtensionIdList extension_ids_;
-
- DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModel);
-};
-
-#endif // CHROME_BROWSER_UI_TOOLBAR_ACTION_BOX_MENU_MODEL_H_
diff --git a/chrome/browser/ui/toolbar/action_box_menu_model_unittest.cc b/chrome/browser/ui/toolbar/action_box_menu_model_unittest.cc
deleted file mode 100644
index 8b5b419..0000000
--- a/chrome/browser/ui/toolbar/action_box_menu_model_unittest.cc
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
-
-#include "base/memory/scoped_ptr.h"
-#include "base/prefs/testing_pref_service.h"
-#include "base/values.h"
-#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_command_controller.h"
-#include "chrome/browser/ui/browser_commands.h"
-#include "chrome/browser/ui/toolbar/action_box_button_controller.h"
-#include "chrome/common/extensions/feature_switch.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/test/base/browser_with_test_window_test.h"
-#include "chrome/test/base/testing_profile.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "sync/notifier/invalidation_util.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/base/resource/resource_bundle.h"
-
-using extensions::FeatureSwitch;
-
-class ActionBoxMenuModelTest : public BrowserWithTestWindowTest,
- public ActionBoxButtonController::Delegate {
- public:
- ActionBoxMenuModelTest() {}
-
- virtual void SetUp() OVERRIDE {
- BrowserWithTestWindowTest::SetUp();
- controller_.reset(new ActionBoxButtonController(browser(), this));
- }
-
- virtual void TearDown() OVERRIDE {
- controller_.reset();
- BrowserWithTestWindowTest::TearDown();
- }
-
- scoped_ptr<ActionBoxMenuModel> CreateModel() {
- return controller_->CreateMenuModel();
- }
-
- void InitProfile(){
- profile()->set_incognito(true);
- profile()->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername);
- }
-
- void SetProfileSignedIn() {
- profile()->set_incognito(false);
- // Set username pref (i.e. sign in),
- profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, "foo");
- }
-
- void NavigateToBookmarkablePage() {
- AddTab(browser(), GURL("http://www.google.com"));
- }
-
- void NavigateToLocalPage() {
- AddTab(browser(), GURL("chrome://blank"));
- }
-
- private:
- scoped_ptr<ActionBoxButtonController> controller_;
-
- DISALLOW_COPY_AND_ASSIGN(ActionBoxMenuModelTest);
-};
-
-// Tests that Bookmark Star is lit up only on bookmarked pages.
-TEST_F(ActionBoxMenuModelTest, BookmarkedPage) {
- FeatureSwitch::ScopedOverride enable_action_box(FeatureSwitch::action_box(),
- true);
- // Set up bookmark model
- profile()->CreateBookmarkModel(true);
- ui_test_utils::WaitForBookmarkModelToLoad(profile());
-
- // Navigate to a url.
- GURL url1("http://www.google.com");
- AddTab(browser(), url1);
-
- scoped_ptr<ActionBoxMenuModel> model = CreateModel();
-
- // Bokomark item should be in menu.
- int bookmark_item_index = model->GetIndexOfCommandId(
- IDC_BOOKMARK_PAGE_FROM_STAR);
- ASSERT_NE(-1, bookmark_item_index);
-
- gfx::Image bookmark_icon;
- gfx::Image unlit_icon;
- gfx::Image lit_icon;
-
- model->GetIconAt(bookmark_item_index, &bookmark_icon);
- unlit_icon =
- ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(IDR_STAR);
-
- SkBitmap bookmark_icon_bitmap = *bookmark_icon.ToSkBitmap();
- SkBitmap unlit_icon_bitmap = *unlit_icon.ToSkBitmap();
- SkAutoLockPixels a(bookmark_icon_bitmap);
- SkAutoLockPixels b(unlit_icon_bitmap);
-
- // Verify that the icon in the menu is the unlit icon.
- EXPECT_EQ(0, memcmp(bookmark_icon_bitmap.getPixels(),
- unlit_icon_bitmap.getPixels(),
- unlit_icon_bitmap.getSize()));
-
- // Now bookmark it.
- chrome::BookmarkCurrentPage(browser());
-
- scoped_ptr<ActionBoxMenuModel> model2 = CreateModel();
-
- model2->GetIconAt(bookmark_item_index, &bookmark_icon);
- lit_icon =
- ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(IDR_STAR_LIT);
-
- SkBitmap bookmark_icon_bitmap2 = *bookmark_icon.ToSkBitmap();
- SkBitmap lit_icon_bitmap = *lit_icon.ToSkBitmap();
- SkAutoLockPixels c(bookmark_icon_bitmap2);
- SkAutoLockPixels d(lit_icon_bitmap);
-
-
- // Verify that the icon in the menu is the lit icon.
- EXPECT_EQ(0, memcmp(bookmark_icon_bitmap2.getPixels(),
- lit_icon_bitmap.getPixels(),
- lit_icon_bitmap.getSize()));
-}
diff --git a/chrome/browser/ui/views/action_box_context_menu.cc b/chrome/browser/ui/views/action_box_context_menu.cc
deleted file mode 100644
index 2beac0b..0000000
--- a/chrome/browser/ui/views/action_box_context_menu.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/action_box_context_menu.h"
-
-#include "chrome/browser/ui/toolbar/action_box_context_menu_controller.h"
-#include "ui/gfx/point.h"
-#include "ui/gfx/size.h"
-#include "ui/views/controls/menu/menu_model_adapter.h"
-#include "ui/views/controls/menu/menu_runner.h"
-
-using views::MenuRunner;
-
-ActionBoxContextMenu::ActionBoxContextMenu(
- Browser* browser,
- const extensions::Extension* extension)
- : controller_(browser, extension) {
-}
-
-ActionBoxContextMenu::~ActionBoxContextMenu() {
-}
-
-views::MenuRunner::RunResult ActionBoxContextMenu::RunMenuAt(
- const gfx::Point& p,
- views::Widget* parent_widget,
- ui::MenuSourceType source_type) {
- adapter_.reset(new views::MenuModelAdapter(controller_.menu_model()));
- menu_runner_.reset(new MenuRunner(adapter_->CreateMenu()));
- return menu_runner_->RunMenuAt(
- parent_widget,
- NULL, // No menu button.
- gfx::Rect(p, gfx::Size()),
- views::MenuItemView::TOPLEFT,
- source_type,
- (MenuRunner::CONTEXT_MENU | MenuRunner::IS_NESTED |
- MenuRunner::HAS_MNEMONICS));
-}
diff --git a/chrome/browser/ui/views/action_box_context_menu.h b/chrome/browser/ui/views/action_box_context_menu.h
deleted file mode 100644
index 605f40b..0000000
--- a/chrome/browser/ui/views/action_box_context_menu.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_ACTION_BOX_CONTEXT_MENU_H__
-#define CHROME_BROWSER_UI_VIEWS_ACTION_BOX_CONTEXT_MENU_H__
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/ui/toolbar/action_box_context_menu_controller.h"
-#include "ui/views/controls/menu/menu_runner.h"
-
-class Browser;
-
-namespace extensions {
-class Extension;
-} // namespace extensions
-
-namespace gfx {
-class Point;
-} // namespace gfx
-
-namespace views {
-class MenuModelAdapter;
-class Widget;
-} // namespace views
-
-// This is the Views class responsible for showing the context menu for
-// extensions in the action box. Actually building and executing commands is
-// handled by ActionBoxContextMenuController.
-class ActionBoxContextMenu {
- public:
- ActionBoxContextMenu(Browser* browser,
- const extensions::Extension* extension);
- ~ActionBoxContextMenu();
-
- // See comments in menu_runner.h on how the return value should be used.
- views::MenuRunner::RunResult RunMenuAt(
- const gfx::Point& p,
- views::Widget* parent_widget,
- ui::MenuSourceType source_type) WARN_UNUSED_RESULT;
-
- private:
- ActionBoxContextMenuController controller_;
- scoped_ptr<views::MenuModelAdapter> adapter_;
- scoped_ptr<views::MenuRunner> menu_runner_;
-
- DISALLOW_COPY_AND_ASSIGN(ActionBoxContextMenu);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_ACTION_BOX_CONTEXT_MENU_H__
diff --git a/chrome/browser/ui/views/action_box_menu.cc b/chrome/browser/ui/views/action_box_menu.cc
deleted file mode 100644
index d6a7ecd..0000000
--- a/chrome/browser/ui/views/action_box_menu.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/action_box_menu.h"
-
-#include "chrome/browser/extensions/extension_icon_image.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
-#include "chrome/browser/ui/views/action_box_context_menu.h"
-#include "chrome/common/extensions/api/extension_action/action_info.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_constants.h"
-#include "chrome/common/extensions/manifest_handlers/icons_handler.h"
-#include "ui/views/controls/button/menu_button.h"
-#include "ui/views/controls/image_view.h"
-#include "ui/views/controls/menu/menu_runner.h"
-#include "ui/views/view.h"
-
-using extensions::ActionInfo;
-using extensions::Extension;
-using extensions::IconImage;
-
-namespace {
-class ExtensionImageView : public views::ImageView, public IconImage::Observer {
- public:
- ExtensionImageView(Profile* profile, const Extension* extension) {
- const ActionInfo* page_launcher_info =
- ActionInfo::GetPageLauncherInfo(extension);
- icon_.reset(new IconImage(profile,
- extension,
- page_launcher_info->default_icon,
- extension_misc::EXTENSION_ICON_ACTION,
- extensions::IconsInfo::GetDefaultAppIcon(),
- this));
- SetImage(icon_->image_skia());
- }
-
- private:
- virtual void OnExtensionIconImageChanged(
- extensions::IconImage* image) OVERRIDE {
- SetImage(icon_->image_skia());
- }
-
- scoped_ptr<extensions::IconImage> icon_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionImageView);
-};
-} // namespace
-
-// static
-scoped_ptr<ActionBoxMenu> ActionBoxMenu::Create(
- Browser* browser,
- scoped_ptr<ActionBoxMenuModel> model) {
- scoped_ptr<ActionBoxMenu> menu(new ActionBoxMenu(browser, model.Pass()));
- menu->PopulateMenu();
- return menu.Pass();
-}
-
-ActionBoxMenu::~ActionBoxMenu() {
-}
-
-void ActionBoxMenu::RunMenu(views::MenuButton* menu_button,
- gfx::Point menu_offset) {
- views::View::ConvertPointToScreen(menu_button, &menu_offset);
- menu_parent_ = menu_button->GetWidget();
-
- // Ignore the result since we don't need to handle a deleted menu specially.
- ignore_result(
- menu_runner_->RunMenuAt(menu_parent_,
- menu_button,
- gfx::Rect(menu_offset, menu_button->size()),
- views::MenuItemView::TOPRIGHT,
- ui::MENU_SOURCE_NONE,
- views::MenuRunner::HAS_MNEMONICS));
-}
-
-ActionBoxMenu::ActionBoxMenu(Browser* browser,
- scoped_ptr<ActionBoxMenuModel> model)
- : browser_(browser),
- menu_parent_(NULL),
- model_(model.Pass()) {
- views::MenuItemView* menu = new views::MenuItemView(this);
- menu->set_has_icons(true);
-
- menu_runner_.reset(new views::MenuRunner(menu));
-}
-
-void ActionBoxMenu::ExecuteCommand(int id) {
- model_->ExecuteCommand(id);
-}
-
-bool ActionBoxMenu::ShowContextMenu(views::MenuItemView* source,
- int id,
- const gfx::Point& p,
- ui::MenuSourceType source_type) {
- DCHECK(menu_parent_);
-
- int index = model_->GetIndexOfCommandId(id);
- if (!model_->IsItemExtension(index))
- return false;
-
- context_menu_.reset(
- new ActionBoxContextMenu(browser_, model_->GetExtensionAt(index)));
- if (context_menu_->RunMenuAt(p, menu_parent_, source_type) ==
- views::MenuRunner::MENU_DELETED)
- return true;
- context_menu_.reset();
- return true;
-}
-
-void ActionBoxMenu::PopulateMenu() {
- for (int model_index = 0; model_index < model_->GetItemCount();
- ++model_index) {
- views::MenuItemView* menu_item =
- menu_runner_->GetMenu()->AppendMenuItemFromModel(
- model_.get(), model_index, model_->GetCommandIdAt(model_index));
- if (model_->GetTypeAt(model_index) == ui::MenuModel::TYPE_COMMAND) {
- if (model_->IsItemExtension(model_index)) {
- const Extension* extension = model_->GetExtensionAt(model_index);
- ExtensionImageView* view = new ExtensionImageView(browser_->profile(),
- extension);
- // |menu_item| will own the |view| from now on.
- menu_item->SetIconView(view);
- }
- }
- }
-}
diff --git a/chrome/browser/ui/views/action_box_menu.h b/chrome/browser/ui/views/action_box_menu.h
deleted file mode 100644
index 3248013..0000000
--- a/chrome/browser/ui/views/action_box_menu.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_ACTION_BOX_MENU_H_
-#define CHROME_BROWSER_UI_VIEWS_ACTION_BOX_MENU_H_
-
-#include "base/memory/scoped_ptr.h"
-#include "ui/views/controls/menu/menu_delegate.h"
-
-class ActionBoxContextMenu;
-class ActionBoxMenuModel;
-class Browser;
-
-namespace views {
-class MenuButton;
-class MenuItemView;
-class MenuRunner;
-}
-
-// ActionBoxMenu adapts the ActionBoxMenuModel to view's menu related classes.
-class ActionBoxMenu : public views::MenuDelegate {
- public:
- // Constructs and initializes an ActionBoxMenu.
- static scoped_ptr<ActionBoxMenu> Create(Browser* browser,
- scoped_ptr<ActionBoxMenuModel> model);
-
- virtual ~ActionBoxMenu();
-
- // Shows the menu relative to the specified button.
- void RunMenu(views::MenuButton* menu_button, gfx::Point menu_offset);
-
- private:
- ActionBoxMenu(Browser* browser, scoped_ptr<ActionBoxMenuModel> model);
-
- // Overridden from views::MenuDelegate:
- virtual void ExecuteCommand(int id) OVERRIDE;
- virtual bool ShowContextMenu(views::MenuItemView* source,
- int id,
- const gfx::Point& p,
- ui::MenuSourceType source_type) OVERRIDE;
-
- // Populates |root_| with all the child menu items from the |model_|.
- void PopulateMenu();
-
- Browser* browser_;
-
- scoped_ptr<ActionBoxContextMenu> context_menu_;
- scoped_ptr<views::MenuRunner> menu_runner_;
- views::Widget* menu_parent_;
-
- // The model that tracks the order of the toolbar icons.
- scoped_ptr<ActionBoxMenuModel> model_;
-
- DISALLOW_COPY_AND_ASSIGN(ActionBoxMenu);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_ACTION_BOX_MENU_H_
diff --git a/chrome/browser/ui/views/location_bar/action_box_button_view.cc b/chrome/browser/ui/views/location_bar/action_box_button_view.cc
deleted file mode 100644
index 89dd94e..0000000
--- a/chrome/browser/ui/views/location_bar/action_box_button_view.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/location_bar/action_box_button_view.h"
-
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
-#include "chrome/browser/ui/view_ids.h"
-#include "chrome/browser/ui/views/action_box_menu.h"
-#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/accessibility/accessible_view_state.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/path.h"
-
-ActionBoxButtonView::ActionBoxButtonView(Browser* browser,
- const gfx::Point& menu_offset)
- : views::MenuButton(NULL, string16(), this, false),
- browser_(browser),
- menu_offset_(menu_offset),
- controller_(browser, this) {
- set_id(VIEW_ID_ACTION_BOX_BUTTON);
- SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_ACTION_BOX_BUTTON));
- SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_ACTION_BOX_BUTTON_NORMAL));
- SetHoverIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_ACTION_BOX_BUTTON_HOVER));
- SetPushedIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_ACTION_BOX_BUTTON_PRESSED));
- set_accessibility_focusable(true);
- set_border(NULL);
- SizeToPreferredSize();
-}
-
-ActionBoxButtonView::~ActionBoxButtonView() {
-}
-
-int ActionBoxButtonView::GetBuiltInHorizontalPadding() const {
- return GetBuiltInHorizontalPaddingImpl();
-}
-
-void ActionBoxButtonView::GetAccessibleState(ui::AccessibleViewState* state) {
- MenuButton::GetAccessibleState(state);
- state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_ACTION_BOX_BUTTON);
-}
-
-void ActionBoxButtonView::OnMenuButtonClicked(View* source,
- const gfx::Point& point) {
- controller_.OnButtonClicked();
-}
-
-void ActionBoxButtonView::ShowMenu(scoped_ptr<ActionBoxMenuModel> menu_model) {
- menu_ = ActionBoxMenu::Create(browser_, menu_model.Pass());
- menu_->RunMenu(this, menu_offset_);
-}
diff --git a/chrome/browser/ui/views/location_bar/action_box_button_view.h b/chrome/browser/ui/views/location_bar/action_box_button_view.h
deleted file mode 100644
index f3d02de..0000000
--- a/chrome/browser/ui/views/location_bar/action_box_button_view.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ACTION_BOX_BUTTON_VIEW_H_
-#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ACTION_BOX_BUTTON_VIEW_H_
-
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/ui/toolbar/action_box_button_controller.h"
-#include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h"
-#include "ui/views/controls/button/menu_button.h"
-#include "ui/views/controls/button/menu_button_listener.h"
-
-class ActionBoxMenu;
-class Browser;
-
-// ActionBoxButtonView displays a plus button with associated menu.
-class ActionBoxButtonView : public views::MenuButton,
- public views::MenuButtonListener,
- public ActionBoxButtonController::Delegate,
- public TouchableLocationBarView {
- public:
- ActionBoxButtonView(Browser* browser, const gfx::Point& menu_offset);
- virtual ~ActionBoxButtonView();
-
- ActionBoxButtonController* action_box_button_controller() {
- return &controller_;
- }
-
- // TouchableLocationBarView:
- virtual int GetBuiltInHorizontalPadding() const OVERRIDE;
-
- private:
- // Overridden from views::CustomButton:
- virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
-
- // Overridden from views::MenuButtonListener:
- virtual void OnMenuButtonClicked(View* source,
- const gfx::Point& point) OVERRIDE;
-
- // Overridden from ActionBoxButtonController::Delegate:
- virtual void ShowMenu(scoped_ptr<ActionBoxMenuModel> menu_model) OVERRIDE;
-
- Browser* browser_;
-
- gfx::Point menu_offset_;
-
- ActionBoxButtonController controller_;
-
- scoped_ptr<ActionBoxMenu> menu_;
-
- DISALLOW_COPY_AND_ASSIGN(ActionBoxButtonView);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ACTION_BOX_BUTTON_VIEW_H_
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index b5c3cf0..352f878 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -38,7 +38,6 @@
#include "chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h"
#include "chrome/browser/ui/views/browser_dialogs.h"
#include "chrome/browser/ui/views/extensions/extension_popup.h"
-#include "chrome/browser/ui/views/location_bar/action_box_button_view.h"
#include "chrome/browser/ui/views/location_bar/autofill_credit_card_view.h"
#include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
#include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
@@ -76,6 +75,7 @@
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/skia_util.h"
+#include "ui/native_theme/native_theme.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/button_drag_utils.h"
@@ -96,7 +96,6 @@
#if !defined(OS_CHROMEOS)
#include "chrome/browser/ui/views/first_run_bubble.h"
-#include "ui/native_theme/native_theme.h"
#endif
#if defined(USE_AURA)
@@ -187,7 +186,6 @@ LocationBarView::LocationBarView(Browser* browser,
open_pdf_in_reader_view_(NULL),
script_bubble_icon_view_(NULL),
star_view_(NULL),
- action_box_button_view_(NULL),
is_popup_mode_(is_popup_mode),
show_focus_rect_(false),
template_url_service_(NULL),
@@ -343,14 +341,6 @@ void LocationBarView::Init() {
star_view_->SetVisible(false);
AddChildView(star_view_);
- if (extensions::FeatureSwitch::action_box()->IsEnabled() && !is_popup_mode_ &&
- browser_) {
- action_box_button_view_ = new ActionBoxButtonView(
- browser_,
- gfx::Point(GetHorizontalEdgeThickness(), vertical_edge_thickness()));
- AddChildView(action_box_button_view_);
- }
-
registrar_.Add(this,
chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
content::Source<Profile>(profile_));
@@ -487,12 +477,9 @@ void LocationBarView::Update(const WebContents* tab_for_state_restoring) {
command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE_FROM_STAR,
star_enabled);
- if (star_view_ && !extensions::FeatureSwitch::action_box()->IsEnabled())
+ if (star_view_)
star_view_->SetVisible(star_enabled);
- if (action_box_button_view_)
- action_box_button_view_->SetVisible(!model_->GetInputInProgress());
-
location_entry_->Update(tab_for_state_restoring);
OnChanged();
@@ -588,22 +575,13 @@ views::View* LocationBarView::GetPageActionView(ExtensionAction *page_action) {
}
void LocationBarView::SetStarToggled(bool on) {
- if (!star_view_)
- return;
- star_view_->SetToggled(on);
- if (action_box_button_view_ && (star_view_->visible() != on)) {
- star_view_->SetVisible(on);
- Layout();
- }
+ if (star_view_)
+ star_view_->SetToggled(on);
}
void LocationBarView::ShowBookmarkPrompt() {
- if (action_box_button_view_) {
- BookmarkPromptView::ShowPrompt(action_box_button_view_,
- profile_->GetPrefs());
- } else if (star_view_ && star_view_->visible()) {
+ if (star_view_ && star_view_->visible())
BookmarkPromptView::ShowPrompt(star_view_, profile_->GetPrefs());
- }
}
void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) {
@@ -737,12 +715,6 @@ void LocationBarView::Layout() {
location_icon_view_);
}
- if (action_box_button_view_ && action_box_button_view_->visible()) {
- trailing_decorations.AddDecoration(
- vertical_edge_thickness(), location_height,
- action_box_button_view_->GetBuiltInHorizontalPadding(),
- action_box_button_view_);
- }
if (star_view_ && star_view_->visible()) {
trailing_decorations.AddDecoration(
vertical_edge_thickness(), location_height,
@@ -1160,8 +1132,6 @@ void LocationBarView::RefreshPageActionViews() {
right_anchor = star_view_;
if (!right_anchor)
right_anchor = script_bubble_icon_view_;
- if (!right_anchor)
- right_anchor = action_box_button_view_;
DCHECK(right_anchor);
// Add the page actions in reverse order, so that the child views are
@@ -1487,11 +1457,6 @@ void LocationBarView::TestPageActionPressed(size_t index) {
NOTREACHED();
}
-void LocationBarView::TestActionBoxMenuItemSelected(int command_id) {
- action_box_button_view_->action_box_button_controller()->
- ExecuteCommand(command_id, 0);
-}
-
bool LocationBarView::GetBookmarkStarVisibility() {
DCHECK(star_view_);
return star_view_->visible();
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
index 0fc5ddf..96151da 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -310,7 +310,6 @@ class LocationBarView : public LocationBar,
virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE;
virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE;
virtual void TestPageActionPressed(size_t index) OVERRIDE;
- virtual void TestActionBoxMenuItemSelected(int command_id) OVERRIDE;
virtual bool GetBookmarkStarVisibility() OVERRIDE;
// TemplateURLServiceObserver:
@@ -502,9 +501,6 @@ class LocationBarView : public LocationBar,
// The star.
StarView* star_view_;
- // The action box button (plus).
- ActionBoxButtonView* action_box_button_view_;
-
// Whether we're in popup mode.
const bool is_popup_mode_;
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi
index c974d6f..aabc152 100644
--- a/chrome/chrome_browser_extensions.gypi
+++ b/chrome/chrome_browser_extensions.gypi
@@ -329,8 +329,6 @@
'browser/extensions/api/omnibox/omnibox_api.h',
'browser/extensions/api/page_capture/page_capture_api.cc',
'browser/extensions/api/page_capture/page_capture_api.h',
- 'browser/extensions/api/page_launcher/page_launcher_api.cc',
- 'browser/extensions/api/page_launcher/page_launcher_api.h',
'browser/extensions/api/permissions/permissions_api.cc',
'browser/extensions/api/permissions/permissions_api.h',
'browser/extensions/api/permissions/permissions_api_helpers.cc',
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 3237313..0d8a9b0 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -737,8 +737,6 @@
'browser/ui/cocoa/l10n_util.mm',
'browser/ui/cocoa/last_active_browser_cocoa.cc',
'browser/ui/cocoa/last_active_browser_cocoa.h',
- 'browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.h',
- 'browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm',
'browser/ui/cocoa/location_bar/autocomplete_text_field.h',
'browser/ui/cocoa/location_bar/autocomplete_text_field.mm',
'browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h',
@@ -765,8 +763,6 @@
'browser/ui/cocoa/location_bar/location_icon_decoration.mm',
'browser/ui/cocoa/location_bar/page_action_decoration.h',
'browser/ui/cocoa/location_bar/page_action_decoration.mm',
- 'browser/ui/cocoa/location_bar/plus_decoration.h',
- 'browser/ui/cocoa/location_bar/plus_decoration.mm',
'browser/ui/cocoa/location_bar/selected_keyword_decoration.h',
'browser/ui/cocoa/location_bar/selected_keyword_decoration.mm',
'browser/ui/cocoa/location_bar/star_decoration.h',
@@ -1010,8 +1006,6 @@
'browser/ui/gtk/accelerator_utils_gtk.cc',
'browser/ui/gtk/accelerators_gtk.cc',
'browser/ui/gtk/accelerators_gtk.h',
- 'browser/ui/gtk/action_box_button_gtk.cc',
- 'browser/ui/gtk/action_box_button_gtk.h',
'browser/ui/gtk/autofill/autofill_popup_view_gtk.cc',
'browser/ui/gtk/autofill/autofill_popup_view_gtk.h',
'browser/ui/gtk/avatar_menu_bubble_gtk.cc',
@@ -1495,12 +1489,6 @@
'browser/ui/tabs/tab_strip_model_utils.h',
'browser/ui/tabs/tab_utils.cc',
'browser/ui/tabs/tab_utils.h',
- 'browser/ui/toolbar/action_box_button_controller.cc',
- 'browser/ui/toolbar/action_box_button_controller.h',
- 'browser/ui/toolbar/action_box_context_menu_controller.cc',
- 'browser/ui/toolbar/action_box_context_menu_controller.h',
- 'browser/ui/toolbar/action_box_menu_model.cc',
- 'browser/ui/toolbar/action_box_menu_model.h',
'browser/ui/toolbar/back_forward_menu_model.cc',
'browser/ui/toolbar/back_forward_menu_model.h',
'browser/ui/toolbar/bookmark_sub_menu_model.cc',
@@ -1535,10 +1523,6 @@
'browser/ui/views/accessibility/accessibility_event_router_views.h',
'browser/ui/views/accessibility/invert_bubble_view.cc',
'browser/ui/views/accessibility/invert_bubble_view.h',
- 'browser/ui/views/action_box_context_menu.cc',
- 'browser/ui/views/action_box_context_menu.h',
- 'browser/ui/views/action_box_menu.cc',
- 'browser/ui/views/action_box_menu.h',
'browser/ui/views/app_menu_button_win.cc',
'browser/ui/views/app_menu_button_win.h',
'browser/ui/views/app_list/app_list_controller_win.cc',
@@ -1780,8 +1764,6 @@
'browser/ui/views/javascript_app_modal_dialog_views.h',
'browser/ui/views/load_complete_listener.cc',
'browser/ui/views/load_complete_listener.h',
- 'browser/ui/views/location_bar/action_box_button_view.cc',
- 'browser/ui/views/location_bar/action_box_button_view.h',
'browser/ui/views/location_bar/autofill_credit_card_view.cc',
'browser/ui/views/location_bar/autofill_credit_card_view.h',
'browser/ui/views/location_bar/content_setting_image_view.cc',
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index a3fdf67..50d47be 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -193,8 +193,6 @@
'common/extensions/api/media_galleries_private/media_galleries_handler.cc',
'common/extensions/api/omnibox/omnibox_handler.cc',
'common/extensions/api/omnibox/omnibox_handler.h',
- 'common/extensions/api/page_launcher/page_launcher_handler.cc',
- 'common/extensions/api/page_launcher/page_launcher_handler.h',
'common/extensions/api/plugins/plugins_handler.cc',
'common/extensions/api/plugins/plugins_handler.h',
'common/extensions/api/speech/tts_engine_manifest_handler.cc',
diff --git a/chrome/chrome_nibs.gyp b/chrome/chrome_nibs.gyp
index aca4a67..2e12fc6 100644
--- a/chrome/chrome_nibs.gyp
+++ b/chrome/chrome_nibs.gyp
@@ -183,8 +183,6 @@
'browser/ui/cocoa/infobars/infobar_controller.mm',
'browser/ui/cocoa/infobars/infobar_gradient_view.h',
'browser/ui/cocoa/infobars/infobar_gradient_view.mm',
- 'browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.h',
- 'browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm',
'browser/ui/cocoa/location_bar/autocomplete_text_field.h',
'browser/ui/cocoa/location_bar/autocomplete_text_field.mm',
'browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 20ec41a..1412782 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -235,7 +235,6 @@
'browser/ui/fullscreen/fullscreen_controller_state_interactive_browsertest.cc',
'browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc',
'browser/ui/gtk/bookmarks/bookmark_bubble_gtk_browsertest.cc',
- 'browser/ui/omnibox/action_box_browsertest.cc',
'browser/ui/omnibox/omnibox_view_browsertest.cc',
'browser/ui/panels/base_panel_browser_test.cc',
'browser/ui/panels/base_panel_browser_test.h',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 8e502f8..7287085 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -1442,7 +1442,6 @@
'browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm',
'browser/ui/cocoa/infobars/infobar_gradient_view_unittest.mm',
'browser/ui/cocoa/infobars/translate_infobar_unittest.mm',
- 'browser/ui/cocoa/location_bar/action_box_menu_bubble_controller_unittest.mm',
'browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm',
'browser/ui/cocoa/location_bar/autocomplete_text_field_editor_unittest.mm',
'browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm',
@@ -1544,7 +1543,6 @@
'browser/ui/tabs/test_tab_strip_model_delegate.h',
'browser/ui/tests/ui_gfx_image_unittest.cc',
'browser/ui/tests/ui_gfx_image_unittest.mm',
- 'browser/ui/toolbar/action_box_menu_model_unittest.cc',
'browser/ui/toolbar/back_forward_menu_model_unittest.cc',
'browser/ui/toolbar/encoding_menu_controller_unittest.cc',
'browser/ui/toolbar/recent_tabs_builder_test_helper.cc',
@@ -1635,7 +1633,6 @@
'common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc',
'common/extensions/api/i18n/default_locale_manifest_unittest.cc',
'common/extensions/api/identity/extension_manifests_auth_unittest.cc',
- 'common/extensions/api/page_launcher/page_launcher_manifest_unittest.cc',
'common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc',
'common/extensions/command_unittest.cc',
'common/extensions/csp_validator_unittest.cc',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index f4567d3..81b7dbb 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -21,9 +21,6 @@ namespace switches {
// all work out.
// -----------------------------------------------------------------------------
-// Enables or disables the "action box" UI in the toolbar.
-const char kActionBox[] = "action-box";
-
// Allows third-party content included on a page to prompt for a HTTP basic
// auth username/password pair.
const char kAllowCrossOriginAuthPrompt[] = "allow-cross-origin-auth-prompt";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 2ca9c92..7ae2b4d 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -24,7 +24,6 @@ namespace switches {
// All switches in alphabetical order. The switches should be documented
// alongside the definition of their values in the .cc file.
-extern const char kActionBox[];
extern const char kAllowCrossOriginAuthPrompt[];
extern const char kAllowFileAccess[];
extern const char kAllowHTTPBackgroundPage[];
diff --git a/chrome/common/extensions/api/api.gyp b/chrome/common/extensions/api/api.gyp
index 0a98a3d..6aeef3d 100644
--- a/chrome/common/extensions/api/api.gyp
+++ b/chrome/common/extensions/api/api.gyp
@@ -79,7 +79,6 @@
'notifications.idl',
'omnibox.json',
'page_capture.json',
- 'page_launcher.idl',
'permissions.json',
'preferences_private.json',
'power.idl',
diff --git a/chrome/common/extensions/api/extension_action/action_info.cc b/chrome/common/extensions/api/extension_action/action_info.cc
index 5714e68..6d0ae6d 100644
--- a/chrome/common/extensions/api/extension_action/action_info.cc
+++ b/chrome/common/extensions/api/extension_action/action_info.cc
@@ -196,11 +196,6 @@ const ActionInfo* ActionInfo::GetScriptBadgeInfo(const Extension* extension) {
}
// static
-const ActionInfo* ActionInfo::GetPageLauncherInfo(const Extension* extension) {
- return GetActionInfo(extension, keys::kPageLauncher);
-}
-
-// static
const ActionInfo* ActionInfo::GetSystemIndicatorInfo(
const Extension* extension) {
return GetActionInfo(extension, keys::kSystemIndicator);
@@ -225,11 +220,6 @@ void ActionInfo::SetScriptBadgeInfo(Extension* extension, ActionInfo* info) {
}
// static
-void ActionInfo::SetPageLauncherInfo(Extension* extension, ActionInfo* info) {
- extension->SetManifestData(keys::kPageLauncher, new ActionInfoData(info));
-}
-
-// static
void ActionInfo::SetSystemIndicatorInfo(Extension* extension,
ActionInfo* info) {
extension->SetManifestData(keys::kSystemIndicator, new ActionInfoData(info));
diff --git a/chrome/common/extensions/api/extension_action/action_info.h b/chrome/common/extensions/api/extension_action/action_info.h
index afbe4c6..fc34528 100644
--- a/chrome/common/extensions/api/extension_action/action_info.h
+++ b/chrome/common/extensions/api/extension_action/action_info.h
@@ -46,9 +46,6 @@ struct ActionInfo {
// Returns the extension's script badge.
static const ActionInfo* GetScriptBadgeInfo(const Extension* etxension);
- // Returns the extension's page launcher.
- static const ActionInfo* GetPageLauncherInfo(const Extension* extension);
-
// Returns the extension's system indicator, if any.
static const ActionInfo* GetSystemIndicatorInfo(const Extension* extension);
@@ -61,9 +58,6 @@ struct ActionInfo {
// Sets the extension's script badge. |extension| takes ownership of |info|.
static void SetScriptBadgeInfo(Extension* extension, ActionInfo* info);
- // Sets the extension's page launcher. |extension| takes ownership of |info|.
- static void SetPageLauncherInfo(Extension* extension, ActionInfo* info);
-
// Sets the extension's system indicator. |extension| takes ownership of
// |info|.
static void SetSystemIndicatorInfo(Extension* extension, ActionInfo* info);
diff --git a/chrome/common/extensions/api/page_launcher.idl b/chrome/common/extensions/api/page_launcher.idl
deleted file mode 100644
index fceab2b..0000000
--- a/chrome/common/extensions/api/page_launcher.idl
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Use the <code>chrome.pageLauncher</code> API to provide platform apps with
-// an additional way of launching themselves from the browser. To use this api,
-// an app needs to specify the page_launcher manifest property, then register to
-// listen to pageLauncher.onClicked events.
-namespace pageLauncher {
- // Information about the page the user was on when the event was fired.
- dictionary PageData {
- // The url of the page.
- DOMString url;
- // The mimetype of the page.
- DOMString mimetype;
- // The title of the page, if it has one.
- DOMString? title;
- // The text that was selected on the page, if any.
- DOMString? selectionText;
- };
-
- interface Events {
- // Fired when the user clicks the page launcher entry in the action box.
- // |pageData| : The details of the page the user was on when the button
- // was clicked.
- static void onClicked(PageData pageData);
- };
-};
diff --git a/chrome/common/extensions/api/page_launcher/page_launcher_handler.cc b/chrome/common/extensions/api/page_launcher/page_launcher_handler.cc
deleted file mode 100644
index 95c7945..0000000
--- a/chrome/common/extensions/api/page_launcher/page_launcher_handler.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/common/extensions/api/page_launcher/page_launcher_handler.h"
-
-#include "base/logging.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
-#include "chrome/common/extensions/api/extension_action/action_info.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_manifest_constants.h"
-#include "chrome/common/extensions/manifest.h"
-
-namespace keys = extension_manifest_keys;
-
-namespace extensions {
-
-PageLauncherHandler::PageLauncherHandler() {
-}
-
-PageLauncherHandler::~PageLauncherHandler() {
-}
-
-bool PageLauncherHandler::Parse(Extension* extension, string16* error) {
- DCHECK(extension->manifest()->HasKey(keys::kPageLauncher));
-
- const base::DictionaryValue* dict;
- if (!extension->manifest()->GetDictionary(keys::kPageLauncher, &dict)) {
- *error = ASCIIToUTF16(extension_manifest_errors::kInvalidPageLauncher);
- return false;
- }
-
- scoped_ptr<ActionInfo> action_info = ActionInfo::Load(extension, dict, error);
- if (!action_info)
- return false;
-
- ActionInfo::SetPageLauncherInfo(extension, action_info.release());
- return true;
-}
-
-const std::vector<std::string> PageLauncherHandler::Keys() const {
- return SingleKey(keys::kPageLauncher);
-}
-
-} // namespace extensions
diff --git a/chrome/common/extensions/api/page_launcher/page_launcher_handler.h b/chrome/common/extensions/api/page_launcher/page_launcher_handler.h
deleted file mode 100644
index 9659d64..0000000
--- a/chrome/common/extensions/api/page_launcher/page_launcher_handler.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_COMMON_EXTENSIONS_API_PAGE_LAUNCHER_PAGE_LAUNCHER_HANDLER_H_
-#define CHROME_COMMON_EXTENSIONS_API_PAGE_LAUNCHER_PAGE_LAUNCHER_HANDLER_H_
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/strings/string16.h"
-#include "chrome/common/extensions/manifest_handler.h"
-
-namespace extensions {
-class Extension;
-
-// Parses the "page_launcher" manifest key.
-class PageLauncherHandler : public ManifestHandler {
- public:
- PageLauncherHandler();
- virtual ~PageLauncherHandler();
-
- virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
-
- private:
- virtual const std::vector<std::string> Keys() const OVERRIDE;
-
- DISALLOW_COPY_AND_ASSIGN(PageLauncherHandler);
-};
-} // namespace extensions
-
-#endif // CHROME_COMMON_EXTENSIONS_API_PAGE_LAUNCHER_PAGE_LAUNCHER_HANDLER_H_
diff --git a/chrome/common/extensions/api/page_launcher/page_launcher_manifest_unittest.cc b/chrome/common/extensions/api/page_launcher/page_launcher_manifest_unittest.cc
deleted file mode 100644
index d432c4d..0000000
--- a/chrome/common/extensions/api/page_launcher/page_launcher_manifest_unittest.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <string>
-
-#include "base/compiler_specific.h"
-#include "chrome/common/extensions/api/extension_action/action_info.h"
-#include "chrome/common/extensions/background_info.h"
-#include "chrome/common/extensions/extension_icon_set.h"
-#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
-
-namespace extensions {
-
-class PageLauncherManifestTest : public ExtensionManifestTest {
- protected:
- virtual char const* test_data_dir() OVERRIDE {
- return "page_launcher";
- }
-};
-
-TEST_F(PageLauncherManifestTest, AppPageLauncherNotPresent) {
- scoped_refptr<Extension> extension =
- LoadAndExpectSuccess("app_page_launcher_not_present.json");
- const ActionInfo* page_launcher_info =
- ActionInfo::GetPageLauncherInfo(extension.get());
- EXPECT_EQ(NULL, page_launcher_info);
-}
-
-TEST_F(PageLauncherManifestTest, AppPageLauncherPresent) {
- scoped_refptr<Extension> extension =
- LoadAndExpectSuccess("app_page_launcher_present.json");
- const ActionInfo* page_launcher_info =
- ActionInfo::GetPageLauncherInfo(extension.get());
- ASSERT_TRUE(page_launcher_info);
- EXPECT_EQ("title", page_launcher_info->default_title);
- EXPECT_TRUE(page_launcher_info->default_icon.ContainsPath("image.jpg"));
-}
-
-TEST_F(PageLauncherManifestTest, ExtensionWithPageLauncher) {
- scoped_refptr<Extension> extension =
- LoadAndExpectSuccess("extension_page_launcher_present.json");
- const ActionInfo* page_launcher_info =
- ActionInfo::GetPageLauncherInfo(extension.get());
- ASSERT_EQ(NULL, page_launcher_info);
-}
-
-} // namespace extensions
diff --git a/chrome/common/extensions/chrome_manifest_handlers.cc b/chrome/common/extensions/chrome_manifest_handlers.cc
index a710fe9..1881868 100644
--- a/chrome/common/extensions/chrome_manifest_handlers.cc
+++ b/chrome/common/extensions/chrome_manifest_handlers.cc
@@ -19,7 +19,6 @@
#include "chrome/common/extensions/api/managed_mode_private/managed_mode_handler.h"
#include "chrome/common/extensions/api/media_galleries_private/media_galleries_handler.h"
#include "chrome/common/extensions/api/omnibox/omnibox_handler.h"
-#include "chrome/common/extensions/api/page_launcher/page_launcher_handler.h"
#include "chrome/common/extensions/api/plugins/plugins_handler.h"
#include "chrome/common/extensions/api/speech/tts_engine_manifest_handler.h"
#include "chrome/common/extensions/api/spellcheck/spellcheck_handler.h"
@@ -81,7 +80,6 @@ void RegisterChromeManifestHandlers() {
(new OmniboxHandler)->Register();
(new OptionsPageHandler)->Register();
(new PageActionHandler)->Register();
- (new PageLauncherHandler)->Register();
(new PluginsHandler)->Register();
(new RequirementsHandler)->Register();
(new SandboxedPageHandler)->Register();
diff --git a/chrome/common/extensions/extension_manifest_constants.cc b/chrome/common/extensions/extension_manifest_constants.cc
index 9257131..dff9e6b 100644
--- a/chrome/common/extensions/extension_manifest_constants.cc
+++ b/chrome/common/extensions/extension_manifest_constants.cc
@@ -92,7 +92,6 @@ const char kPageActionId[] = "id";
const char kPageActionPopup[] = "popup";
const char kPageActionPopupPath[] = "path";
const char kPageActions[] = "page_actions";
-const char kPageLauncher[] = "page_launcher";
const char kPermissions[] = "permissions";
const char kPlatformAppBackground[] = "app.background";
const char kPlatformAppBackgroundPage[] = "app.background.page";
@@ -480,8 +479,6 @@ const char kInvalidPageActionsListSize[] =
"Invalid value for 'page_actions'. There can be at most one page action.";
const char kInvalidPageActionTypeValue[] =
"Invalid value for 'page_actions[*].type', expected 'tab' or 'permanent'.";
-const char kInvalidPageLauncher[] =
- "Invalid value for 'page_launcher'.";
const char kInvalidPermission[] =
"Invalid value for 'permissions[*]'.";
const char kInvalidPermissions[] =
diff --git a/chrome/common/extensions/extension_manifest_constants.h b/chrome/common/extensions/extension_manifest_constants.h
index 6653f02..cc56bb6 100644
--- a/chrome/common/extensions/extension_manifest_constants.h
+++ b/chrome/common/extensions/extension_manifest_constants.h
@@ -104,7 +104,6 @@ namespace extension_manifest_keys {
extern const char kPageActionPopup[];
extern const char kPageActionPopupPath[];
extern const char kPageActions[];
- extern const char kPageLauncher[];
extern const char kPermissions[];
extern const char kPlatformAppBackground[];
extern const char kPlatformAppBackgroundPage[];
@@ -343,7 +342,6 @@ namespace extension_manifest_errors {
extern const char kInvalidPageActionsList[];
extern const char kInvalidPageActionsListSize[];
extern const char kInvalidPageActionTypeValue[];
- extern const char kInvalidPageLauncher[];
extern const char kInvalidPermission[];
extern const char kInvalidPermissions[];
extern const char kInvalidPermissionScheme[];
diff --git a/chrome/common/extensions/feature_switch.cc b/chrome/common/extensions/feature_switch.cc
index e8d2664..5ea3445 100644
--- a/chrome/common/extensions/feature_switch.cc
+++ b/chrome/common/extensions/feature_switch.cc
@@ -17,10 +17,7 @@ namespace {
class CommonSwitches {
public:
CommonSwitches()
- : action_box(
- switches::kActionBox,
- FeatureSwitch::DEFAULT_DISABLED),
- easy_off_store_install(
+ : easy_off_store_install(
switches::kEasyOffStoreExtensionInstall,
FeatureSwitch::DEFAULT_DISABLED),
script_badges(
@@ -40,7 +37,6 @@ class CommonSwitches {
switches::kTabCapture,
FeatureSwitch::DEFAULT_ENABLED) {}
- FeatureSwitch action_box;
FeatureSwitch easy_off_store_install;
FeatureSwitch script_badges;
FeatureSwitch script_bubble;
@@ -53,10 +49,6 @@ base::LazyInstance<CommonSwitches> g_common_switches =
} // namespace
-
-FeatureSwitch* FeatureSwitch::action_box() {
- return &g_common_switches.Get().action_box;
-}
FeatureSwitch* FeatureSwitch::easy_off_store_install() {
return &g_common_switches.Get().easy_off_store_install;
}
diff --git a/chrome/common/extensions/feature_switch.h b/chrome/common/extensions/feature_switch.h
index 1ec5500..acb0465 100644
--- a/chrome/common/extensions/feature_switch.h
+++ b/chrome/common/extensions/feature_switch.h
@@ -17,7 +17,6 @@ namespace extensions {
// command-line switches but can be overridden, e.g., for testing.
class FeatureSwitch {
public:
- static FeatureSwitch* action_box();
static FeatureSwitch* easy_off_store_install();
static FeatureSwitch* script_badges();
static FeatureSwitch* script_bubble();
diff --git a/chrome/test/data/extensions/page_launcher/app_page_launcher_not_present.json b/chrome/test/data/extensions/page_launcher/app_page_launcher_not_present.json
deleted file mode 100644
index 39870ef..0000000
--- a/chrome/test/data/extensions/page_launcher/app_page_launcher_not_present.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "name": "PageLauncher Test",
- "version": "1",
- "app": {
- "background": {
- "scripts": ["background.js"]
- }
- }
-}
diff --git a/chrome/test/data/extensions/page_launcher/app_page_launcher_present.json b/chrome/test/data/extensions/page_launcher/app_page_launcher_present.json
deleted file mode 100644
index cb1c228..0000000
--- a/chrome/test/data/extensions/page_launcher/app_page_launcher_present.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name": "PageLauncher Test",
- "version": "1",
- "page_launcher": {
- "default_icon": "image.jpg",
- "default_title": "title"
- },
- "app": {
- "background": {
- "scripts": ["background.js"]
- }
- }
-}
diff --git a/chrome/test/data/extensions/page_launcher/extension_page_launcher_present.json b/chrome/test/data/extensions/page_launcher/extension_page_launcher_present.json
deleted file mode 100644
index b7b73eb..0000000
--- a/chrome/test/data/extensions/page_launcher/extension_page_launcher_present.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "PageLauncher Test",
- "version": "1",
- "page_launcher": {
- "default_icon": "image.jpg",
- "default_title": "title"
- }
-}
diff --git a/ui/resources/default_100_percent/cros/action_box_button_hover.png b/ui/resources/default_100_percent/cros/action_box_button_hover.png
deleted file mode 100644
index 19c47a1..0000000
--- a/ui/resources/default_100_percent/cros/action_box_button_hover.png
+++ /dev/null
Binary files differ
diff --git a/ui/resources/default_100_percent/cros/action_box_button_normal.png b/ui/resources/default_100_percent/cros/action_box_button_normal.png
deleted file mode 100644
index 54111d6..0000000
--- a/ui/resources/default_100_percent/cros/action_box_button_normal.png
+++ /dev/null
Binary files differ
diff --git a/ui/resources/default_100_percent/cros/action_box_button_pressed.png b/ui/resources/default_100_percent/cros/action_box_button_pressed.png
deleted file mode 100644
index 528f92d..0000000
--- a/ui/resources/default_100_percent/cros/action_box_button_pressed.png
+++ /dev/null
Binary files differ
diff --git a/ui/resources/default_200_percent/cros/action_box_button_hover.png b/ui/resources/default_200_percent/cros/action_box_button_hover.png
deleted file mode 100644
index 4100e40..0000000
--- a/ui/resources/default_200_percent/cros/action_box_button_hover.png
+++ /dev/null
Binary files differ
diff --git a/ui/resources/default_200_percent/cros/action_box_button_normal.png b/ui/resources/default_200_percent/cros/action_box_button_normal.png
deleted file mode 100644
index 790b2da..0000000
--- a/ui/resources/default_200_percent/cros/action_box_button_normal.png
+++ /dev/null
Binary files differ
diff --git a/ui/resources/default_200_percent/cros/action_box_button_pressed.png b/ui/resources/default_200_percent/cros/action_box_button_pressed.png
deleted file mode 100644
index afdeea5f..0000000
--- a/ui/resources/default_200_percent/cros/action_box_button_pressed.png
+++ /dev/null
Binary files differ
diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd
index 917f9f7..8f8c34a 100644
--- a/ui/resources/ui_resources.grd
+++ b/ui/resources/ui_resources.grd
@@ -376,9 +376,6 @@
<if expr="pp_ifdef('use_aura')">
<structure type="chrome_scaled_image" name="IDR_OAK" file="oak.png" />
</if>
- <structure type="chrome_scaled_image" name="IDR_OOBE_ACTION_BOX_BUTTON_HOVER" file="cros/action_box_button_hover.png" />
- <structure type="chrome_scaled_image" name="IDR_OOBE_ACTION_BOX_BUTTON_NORMAL" file="cros/action_box_button_normal.png" />
- <structure type="chrome_scaled_image" name="IDR_OOBE_ACTION_BOX_BUTTON_PRESSED" file="cros/action_box_button_pressed.png" />
<structure type="chrome_scaled_image" name="IDR_PANEL_TOP_LEFT_CORNER" file="panel_top_left_corner.png" />
<structure type="chrome_scaled_image" name="IDR_PANEL_TOP_RIGHT_CORNER" file="panel_top_right_corner.png" />
<structure type="chrome_scaled_image" name="IDR_PANEL_BOTTOM_LEFT_CORNER" file="panel_bottom_left_corner.png" />