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

Side by Side Diff: chrome/browser/extensions/api/extension_action/extension_action_api.h

Issue 25305002: Implement initial chrome.browserAction.openPopup API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to interactive_ui_test Created 7 years, 2 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
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 #ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_
7 7
8 #include <string>
9
8 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" 11 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
10 #include "chrome/browser/extensions/extension_action.h" 12 #include "chrome/browser/extensions/extension_action.h"
11 #include "chrome/browser/extensions/extension_function.h" 13 #include "chrome/browser/extensions/extension_function.h"
12 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
14 16
15 namespace base { 17 namespace base {
16 class DictionaryValue; 18 class DictionaryValue;
17 } 19 }
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 }; 336 };
335 337
336 class BrowserActionDisableFunction : public ExtensionActionHideFunction { 338 class BrowserActionDisableFunction : public ExtensionActionHideFunction {
337 public: 339 public:
338 DECLARE_EXTENSION_FUNCTION("browserAction.disable", BROWSERACTION_DISABLE) 340 DECLARE_EXTENSION_FUNCTION("browserAction.disable", BROWSERACTION_DISABLE)
339 341
340 protected: 342 protected:
341 virtual ~BrowserActionDisableFunction() {} 343 virtual ~BrowserActionDisableFunction() {}
342 }; 344 };
343 345
346 class BrowserActionOpenPopupFunction : public UIThreadExtensionFunction,
347 public content::NotificationObserver {
348 public:
349 DECLARE_EXTENSION_FUNCTION("browserAction.openPopup",
350 BROWSERACTION_OPEN_POPUP)
351 BrowserActionOpenPopupFunction();
352
353 private:
354 virtual ~BrowserActionOpenPopupFunction() {}
355
356 // ExtensionFunction:
357 virtual bool RunImpl() OVERRIDE;
358
359 virtual void Observe(int type,
360 const content::NotificationSource& source,
361 const content::NotificationDetails& details) OVERRIDE;
362 void OpenPopupTimedOut();
363
364 content::NotificationRegistrar registrar_;
365 bool response_sent_;
366
367 DISALLOW_COPY_AND_ASSIGN(BrowserActionOpenPopupFunction);
368 };
369
344 // 370 //
345 // scriptBadge.* aliases for supported scriptBadge APIs. 371 // scriptBadge.* aliases for supported scriptBadge APIs.
346 // 372 //
347 373
348 class ScriptBadgeSetPopupFunction : public ExtensionActionSetPopupFunction { 374 class ScriptBadgeSetPopupFunction : public ExtensionActionSetPopupFunction {
349 public: 375 public:
350 DECLARE_EXTENSION_FUNCTION("scriptBadge.setPopup", SCRIPTBADGE_SETPOPUP) 376 DECLARE_EXTENSION_FUNCTION("scriptBadge.setPopup", SCRIPTBADGE_SETPOPUP)
351 377
352 protected: 378 protected:
353 virtual ~ScriptBadgeSetPopupFunction() {} 379 virtual ~ScriptBadgeSetPopupFunction() {}
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 PAGEACTIONS_DISABLEFORTAB) 494 PAGEACTIONS_DISABLEFORTAB)
469 495
470 protected: 496 protected:
471 virtual ~DisablePageActionsFunction() {} 497 virtual ~DisablePageActionsFunction() {}
472 498
473 // ExtensionFunction: 499 // ExtensionFunction:
474 virtual bool RunImpl() OVERRIDE; 500 virtual bool RunImpl() OVERRIDE;
475 }; 501 };
476 502
477 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H _ 503 #endif // CHROME_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698