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

Side by Side Diff: chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc

Issue 12042096: Move page action manifest parsing out of Extension; the first multi-key manifest handler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h" 5 #include "chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/extensions/api/commands/command_service.h" 14 #include "chrome/browser/extensions/api/commands/command_service.h"
15 #include "chrome/browser/extensions/extension_action.h" 15 #include "chrome/browser/extensions/extension_action.h"
16 #include "chrome/browser/extensions/extension_action_manager.h" 16 #include "chrome/browser/extensions/extension_action_manager.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_dialogs.h" 18 #include "chrome/browser/ui/browser_dialogs.h"
19 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" 19 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h"
20 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" 20 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h"
21 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 21 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
22 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 22 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
23 #include "chrome/browser/ui/gtk/gtk_util.h" 23 #include "chrome/browser/ui/gtk/gtk_util.h"
24 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" 24 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
25 #include "chrome/browser/ui/singleton_tabs.h" 25 #include "chrome/browser/ui/singleton_tabs.h"
26 #include "chrome/common/chrome_notification_types.h" 26 #include "chrome/common/chrome_notification_types.h"
27 #include "chrome/common/extensions/api/extension_action/action_info.h"
27 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h" 28 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h"
28 #include "chrome/common/extensions/extension.h" 29 #include "chrome/common/extensions/extension.h"
29 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
30 #include "content/public/browser/notification_details.h" 31 #include "content/public/browser/notification_details.h"
31 #include "content/public/browser/notification_source.h" 32 #include "content/public/browser/notification_source.h"
32 #include "grit/chromium_strings.h" 33 #include "grit/chromium_strings.h"
33 #include "grit/generated_resources.h" 34 #include "grit/generated_resources.h"
34 #include "grit/theme_resources.h" 35 #include "grit/theme_resources.h"
35 #include "ui/base/gtk/gtk_hig_constants.h" 36 #include "ui/base/gtk/gtk_hig_constants.h"
36 #include "ui/base/l10n/l10n_util.h" 37 #include "ui/base/l10n/l10n_util.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 AddRef(); // Balanced in Close(). 82 AddRef(); // Balanced in Close().
82 83
83 extensions::ExtensionActionManager* extension_action_manager = 84 extensions::ExtensionActionManager* extension_action_manager =
84 ExtensionActionManager::Get(browser_->profile()); 85 ExtensionActionManager::Get(browser_->profile());
85 86
86 if (!extensions::OmniboxInfo::GetKeyword(extension_).empty()) 87 if (!extensions::OmniboxInfo::GetKeyword(extension_).empty())
87 type_ = OMNIBOX_KEYWORD; 88 type_ = OMNIBOX_KEYWORD;
88 else if (extension_action_manager->GetBrowserAction(*extension_)) 89 else if (extension_action_manager->GetBrowserAction(*extension_))
89 type_ = BROWSER_ACTION; 90 type_ = BROWSER_ACTION;
90 else if (extension_action_manager->GetPageAction(*extension) && 91 else if (extension_action_manager->GetPageAction(*extension) &&
91 extensions::OmniboxInfo::IsVerboseInstallMessage(extension)) 92 extensions::ActionInfo::IsVerboseInstallMessage(extension))
92 type_ = PAGE_ACTION; 93 type_ = PAGE_ACTION;
93 else 94 else
94 type_ = GENERIC; 95 type_ = GENERIC;
95 96
96 // |extension| has been initialized but not loaded at this point. We need 97 // |extension| has been initialized but not loaded at this point. We need
97 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets 98 // to wait on showing the Bubble until not only the EXTENSION_LOADED gets
98 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we 99 // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we
99 // be sure that a browser action or page action has had views created which we 100 // be sure that a browser action or page action has had views created which we
100 // can inspect for the purpose of pointing to them. 101 // can inspect for the purpose of pointing to them.
101 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 102 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // on all references being cleared before it is destroyed. 390 // on all references being cleared before it is destroyed.
390 MessageLoopForUI::current()->PostTask( 391 MessageLoopForUI::current()->PostTask(
391 FROM_HERE, 392 FROM_HERE,
392 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); 393 base::Bind(&ExtensionInstalledBubbleGtk::Close, this));
393 } 394 }
394 395
395 void ExtensionInstalledBubbleGtk::Close() { 396 void ExtensionInstalledBubbleGtk::Close() {
396 Release(); // Balanced in ctor. 397 Release(); // Balanced in ctor.
397 bubble_ = NULL; 398 bubble_ = NULL;
398 } 399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698