| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 | 6 |
| 7 #include "app/animation.h" | 7 #include "app/animation.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 if (id >= IDC_BROWSER_ACTION_FIRST && id <= IDC_BROWSER_ACTION_LAST) { | 1472 if (id >= IDC_BROWSER_ACTION_FIRST && id <= IDC_BROWSER_ACTION_LAST) { |
| 1473 ExtensionsService* service = profile_->GetExtensionsService(); | 1473 ExtensionsService* service = profile_->GetExtensionsService(); |
| 1474 DCHECK(service); // No browser action command should have been created | 1474 DCHECK(service); // No browser action command should have been created |
| 1475 // in this window. | 1475 // in this window. |
| 1476 | 1476 |
| 1477 // Go find the browser action in question. | 1477 // Go find the browser action in question. |
| 1478 std::vector<ExtensionAction*> browser_actions = | 1478 std::vector<ExtensionAction*> browser_actions = |
| 1479 service->GetBrowserActions(false); // false means no popup actions. | 1479 service->GetBrowserActions(false); // false means no popup actions. |
| 1480 for (size_t i = 0; i < browser_actions.size(); ++i) { | 1480 for (size_t i = 0; i < browser_actions.size(); ++i) { |
| 1481 if (browser_actions[i]->command_id() == id) { | 1481 if (browser_actions[i]->command_id() == id) { |
| 1482 int window_id = ExtensionTabUtil::GetWindowId(this); | |
| 1483 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( | 1482 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( |
| 1484 profile_, browser_actions[i]->extension_id(), window_id); | 1483 profile_, browser_actions[i]->extension_id(), this); |
| 1485 return; | 1484 return; |
| 1486 } | 1485 } |
| 1487 } | 1486 } |
| 1488 | 1487 |
| 1489 // Could not find the command in question. Perhaps it went away while the | 1488 // Could not find the command in question. Perhaps it went away while the |
| 1490 // menu was open? More likely, it is a bug. | 1489 // menu was open? More likely, it is a bug. |
| 1491 LOG(WARNING) << "Unknown browser action executed: " << id; | 1490 LOG(WARNING) << "Unknown browser action executed: " << id; |
| 1492 } | 1491 } |
| 1493 | 1492 |
| 1494 ExecuteCommandWithDisposition(id, CURRENT_TAB); | 1493 ExecuteCommandWithDisposition(id, CURRENT_TAB); |
| (...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2975 /////////////////////////////////////////////////////////////////////////////// | 2974 /////////////////////////////////////////////////////////////////////////////// |
| 2976 // BrowserToolbarModel (private): | 2975 // BrowserToolbarModel (private): |
| 2977 | 2976 |
| 2978 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2977 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
| 2979 // This |current_tab| can be NULL during the initialization of the | 2978 // This |current_tab| can be NULL during the initialization of the |
| 2980 // toolbar during window creation (i.e. before any tabs have been added | 2979 // toolbar during window creation (i.e. before any tabs have been added |
| 2981 // to the window). | 2980 // to the window). |
| 2982 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2981 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 2983 return current_tab ? ¤t_tab->controller() : NULL; | 2982 return current_tab ? ¤t_tab->controller() : NULL; |
| 2984 } | 2983 } |
| OLD | NEW |