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