OLD | NEW |
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/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/command_updater.h" | 16 #include "chrome/browser/command_updater.h" |
17 #include "chrome/browser/defaults.h" | 17 #include "chrome/browser/defaults.h" |
18 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 18 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
19 #include "chrome/browser/extensions/extension_action.h" | 19 #include "chrome/browser/extensions/extension_action.h" |
| 20 #include "chrome/browser/extensions/extension_action_manager.h" |
20 #include "chrome/browser/extensions/extension_util.h" | 21 #include "chrome/browser/extensions/extension_util.h" |
21 #include "chrome/browser/extensions/location_bar_controller.h" | 22 #include "chrome/browser/extensions/location_bar_controller.h" |
22 #include "chrome/browser/extensions/tab_helper.h" | 23 #include "chrome/browser/extensions/tab_helper.h" |
23 #include "chrome/browser/favicon/favicon_tab_helper.h" | 24 #include "chrome/browser/favicon/favicon_tab_helper.h" |
24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/search/instant_service.h" | 26 #include "chrome/browser/search/instant_service.h" |
26 #include "chrome/browser/search/instant_service_factory.h" | 27 #include "chrome/browser/search/instant_service_factory.h" |
27 #include "chrome/browser/search/search.h" | 28 #include "chrome/browser/search/search.h" |
28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 29 #include "chrome/browser/search_engines/template_url_service_factory.h" |
29 #include "chrome/browser/translate/chrome_translate_client.h" | 30 #include "chrome/browser/translate/chrome_translate_client.h" |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 if (RefreshPageActionViews()) { // Changed. | 1350 if (RefreshPageActionViews()) { // Changed. |
1350 Layout(); | 1351 Layout(); |
1351 SchedulePaint(); | 1352 SchedulePaint(); |
1352 } | 1353 } |
1353 } | 1354 } |
1354 | 1355 |
1355 void LocationBarView::InvalidatePageActions() { | 1356 void LocationBarView::InvalidatePageActions() { |
1356 DeletePageActionViews(); | 1357 DeletePageActionViews(); |
1357 } | 1358 } |
1358 | 1359 |
| 1360 bool LocationBarView::ShowPageActionPopup( |
| 1361 const extensions::Extension* extension, |
| 1362 bool grant_tab_permissions) { |
| 1363 ExtensionAction* extension_action = |
| 1364 extensions::ExtensionActionManager::Get(profile())->GetPageAction( |
| 1365 *extension); |
| 1366 DCHECK(extension_action); |
| 1367 return GetPageActionView(extension_action)->image_view()->view_controller()-> |
| 1368 ExecuteAction(ExtensionPopup::SHOW, grant_tab_permissions); |
| 1369 } |
| 1370 |
1359 void LocationBarView::UpdateOpenPDFInReaderPrompt() { | 1371 void LocationBarView::UpdateOpenPDFInReaderPrompt() { |
1360 open_pdf_in_reader_view_->Update( | 1372 open_pdf_in_reader_view_->Update( |
1361 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents()); | 1373 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents()); |
1362 Layout(); | 1374 Layout(); |
1363 SchedulePaint(); | 1375 SchedulePaint(); |
1364 } | 1376 } |
1365 | 1377 |
1366 void LocationBarView::UpdateGeneratedCreditCardView() { | 1378 void LocationBarView::UpdateGeneratedCreditCardView() { |
1367 generated_credit_card_view_->Update(); | 1379 generated_credit_card_view_->Update(); |
1368 Layout(); | 1380 Layout(); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 | 1726 |
1715 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1727 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
1716 const SearchModel::State& new_state) { | 1728 const SearchModel::State& new_state) { |
1717 const bool visible = !GetToolbarModel()->input_in_progress() && | 1729 const bool visible = !GetToolbarModel()->input_in_progress() && |
1718 new_state.voice_search_supported; | 1730 new_state.voice_search_supported; |
1719 if (mic_search_view_->visible() != visible) { | 1731 if (mic_search_view_->visible() != visible) { |
1720 mic_search_view_->SetVisible(visible); | 1732 mic_search_view_->SetVisible(visible); |
1721 Layout(); | 1733 Layout(); |
1722 } | 1734 } |
1723 } | 1735 } |
OLD | NEW |