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

Side by Side Diff: chrome/browser/ui/gtk/location_bar_view_gtk.cc

Issue 6854035: Move blocked content from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: put back user_gesture Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/location_bar_view_gtk.h" 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/app/chrome_command_ids.h" 17 #include "chrome/app/chrome_command_ids.h"
18 #include "chrome/browser/accessibility_events.h" 18 #include "chrome/browser/accessibility_events.h"
19 #include "chrome/browser/alternate_nav_url_fetcher.h" 19 #include "chrome/browser/alternate_nav_url_fetcher.h"
20 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" 20 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
21 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" 21 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
22 #include "chrome/browser/command_updater.h" 22 #include "chrome/browser/command_updater.h"
23 #include "chrome/browser/content_setting_bubble_model.h"
24 #include "chrome/browser/content_setting_image_model.h"
25 #include "chrome/browser/defaults.h" 23 #include "chrome/browser/defaults.h"
26 #include "chrome/browser/extensions/extension_browser_event_router.h" 24 #include "chrome/browser/extensions/extension_browser_event_router.h"
27 #include "chrome/browser/extensions/extension_service.h" 25 #include "chrome/browser/extensions/extension_service.h"
28 #include "chrome/browser/extensions/extension_tabs_module.h" 26 #include "chrome/browser/extensions/extension_tabs_module.h"
29 #include "chrome/browser/instant/instant_controller.h" 27 #include "chrome/browser/instant/instant_controller.h"
30 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
31 #include "chrome/browser/search_engines/template_url.h" 29 #include "chrome/browser/search_engines/template_url.h"
32 #include "chrome/browser/search_engines/template_url_model.h" 30 #include "chrome/browser/search_engines/template_url_model.h"
33 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
34 #include "chrome/browser/ui/browser_list.h" 32 #include "chrome/browser/ui/browser_list.h"
33 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
34 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
35 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" 35 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h"
36 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" 36 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
37 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" 37 #include "chrome/browser/ui/gtk/cairo_cached_surface.h"
38 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" 38 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h"
39 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" 39 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h"
40 #include "chrome/browser/ui/gtk/first_run_bubble.h" 40 #include "chrome/browser/ui/gtk/first_run_bubble.h"
41 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 41 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
42 #include "chrome/browser/ui/gtk/gtk_util.h" 42 #include "chrome/browser/ui/gtk/gtk_util.h"
43 #include "chrome/browser/ui/gtk/nine_box.h" 43 #include "chrome/browser/ui/gtk/nine_box.h"
44 #include "chrome/browser/ui/gtk/rounded_window.h" 44 #include "chrome/browser/ui/gtk/rounded_window.h"
45 #include "chrome/browser/ui/gtk/view_id_util.h" 45 #include "chrome/browser/ui/gtk/view_id_util.h"
46 #include "chrome/browser/ui/omnibox/location_bar_util.h" 46 #include "chrome/browser/ui/omnibox/location_bar_util.h"
47 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
47 #include "chrome/common/chrome_switches.h" 48 #include "chrome/common/chrome_switches.h"
48 #include "chrome/common/extensions/extension.h" 49 #include "chrome/common/extensions/extension.h"
49 #include "chrome/common/extensions/extension_action.h" 50 #include "chrome/common/extensions/extension_action.h"
50 #include "chrome/common/extensions/extension_resource.h" 51 #include "chrome/common/extensions/extension_resource.h"
51 #include "chrome/common/pref_names.h" 52 #include "chrome/common/pref_names.h"
52 #include "content/browser/tab_contents/tab_contents.h" 53 #include "content/browser/tab_contents/tab_contents.h"
53 #include "content/common/notification_service.h" 54 #include "content/common/notification_service.h"
54 #include "content/common/page_transition_types.h" 55 #include "content/common/page_transition_types.h"
55 #include "grit/generated_resources.h" 56 #include "grit/generated_resources.h"
56 #include "grit/theme_resources.h" 57 #include "grit/theme_resources.h"
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_.get()), FALSE); 1353 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_.get()), FALSE);
1353 } 1354 }
1354 } 1355 }
1355 1356
1356 void LocationBarViewGtk::ContentSettingImageViewGtk::AnimationCanceled( 1357 void LocationBarViewGtk::ContentSettingImageViewGtk::AnimationCanceled(
1357 const ui::Animation* animation) { 1358 const ui::Animation* animation) {
1358 } 1359 }
1359 1360
1360 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnButtonPressed( 1361 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnButtonPressed(
1361 GtkWidget* sender, GdkEvent* event) { 1362 GtkWidget* sender, GdkEvent* event) {
1362 TabContents* tab_contents = parent_->GetTabContents(); 1363 TabContentsWrapper* tab_contents = parent_->GetTabContentsWrapper();
1363 if (!tab_contents) 1364 if (!tab_contents)
1364 return TRUE; 1365 return TRUE;
1365 const ContentSettingsType content_settings_type = 1366 const ContentSettingsType content_settings_type =
1366 content_setting_image_model_->get_content_settings_type(); 1367 content_setting_image_model_->get_content_settings_type();
1367 if (content_settings_type == CONTENT_SETTINGS_TYPE_PRERENDER) 1368 if (content_settings_type == CONTENT_SETTINGS_TYPE_PRERENDER)
1368 return TRUE; 1369 return TRUE;
1369 GURL url = tab_contents->GetURL(); 1370 GURL url = tab_contents->tab_contents()->GetURL();
1370 std::wstring display_host; 1371 std::wstring display_host;
1371 net::AppendFormattedHost(url, 1372 net::AppendFormattedHost(url,
1372 UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)), 1373 UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)),
1373 &display_host, 1374 &display_host,
1374 NULL, NULL); 1375 NULL, NULL);
1375 1376
1376 info_bubble_ = new ContentSettingBubbleGtk( 1377 info_bubble_ = new ContentSettingBubbleGtk(
1377 sender, this, 1378 sender, this,
1378 ContentSettingBubbleModel::CreateContentSettingBubbleModel( 1379 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
1379 tab_contents, profile_, content_settings_type), 1380 tab_contents, profile_, content_settings_type),
1380 profile_, tab_contents); 1381 profile_, tab_contents->tab_contents());
1381 return TRUE; 1382 return TRUE;
1382 } 1383 }
1383 1384
1384 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose( 1385 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose(
1385 GtkWidget* sender, GdkEventExpose* event) { 1386 GtkWidget* sender, GdkEventExpose* event) {
1386 if (!(animation_.IsShowing() || animation_.IsClosing())) 1387 if (!(animation_.IsShowing() || animation_.IsClosing()))
1387 return FALSE; 1388 return FALSE;
1388 1389
1389 const int height = sender->allocation.height; 1390 const int height = sender->allocation.height;
1390 1391
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 1636
1636 std::string badge_text = page_action_->GetBadgeText(tab_id); 1637 std::string badge_text = page_action_->GetBadgeText(tab_id);
1637 if (badge_text.empty()) 1638 if (badge_text.empty())
1638 return FALSE; 1639 return FALSE;
1639 1640
1640 gfx::CanvasSkiaPaint canvas(event, false); 1641 gfx::CanvasSkiaPaint canvas(event, false);
1641 gfx::Rect bounding_rect(widget->allocation); 1642 gfx::Rect bounding_rect(widget->allocation);
1642 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); 1643 page_action_->PaintBadge(&canvas, bounding_rect, tab_id);
1643 return FALSE; 1644 return FALSE;
1644 } 1645 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698