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

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: 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 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_.get()), FALSE); 1352 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_.get()), FALSE);
1352 } 1353 }
1353 } 1354 }
1354 1355
1355 void LocationBarViewGtk::ContentSettingImageViewGtk::AnimationCanceled( 1356 void LocationBarViewGtk::ContentSettingImageViewGtk::AnimationCanceled(
1356 const ui::Animation* animation) { 1357 const ui::Animation* animation) {
1357 } 1358 }
1358 1359
1359 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnButtonPressed( 1360 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnButtonPressed(
1360 GtkWidget* sender, GdkEvent* event) { 1361 GtkWidget* sender, GdkEvent* event) {
1361 TabContents* tab_contents = parent_->GetTabContents(); 1362 TabContentsWrapper* tab_contents = parent_->GetTabContentsWrapper();
1362 if (!tab_contents) 1363 if (!tab_contents)
1363 return TRUE; 1364 return TRUE;
1364 const ContentSettingsType content_settings_type = 1365 const ContentSettingsType content_settings_type =
1365 content_setting_image_model_->get_content_settings_type(); 1366 content_setting_image_model_->get_content_settings_type();
1366 if (content_settings_type == CONTENT_SETTINGS_TYPE_PRERENDER) 1367 if (content_settings_type == CONTENT_SETTINGS_TYPE_PRERENDER)
1367 return TRUE; 1368 return TRUE;
1368 GURL url = tab_contents->GetURL(); 1369 GURL url = tab_contents->tab_contents()->GetURL();
1369 std::wstring display_host; 1370 std::wstring display_host;
1370 net::AppendFormattedHost(url, 1371 net::AppendFormattedHost(url,
1371 UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)), 1372 UTF8ToWide(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)),
1372 &display_host, 1373 &display_host,
1373 NULL, NULL); 1374 NULL, NULL);
1374 1375
1375 info_bubble_ = new ContentSettingBubbleGtk( 1376 info_bubble_ = new ContentSettingBubbleGtk(
1376 sender, this, 1377 sender, this,
1377 ContentSettingBubbleModel::CreateContentSettingBubbleModel( 1378 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
1378 tab_contents, profile_, content_settings_type), 1379 tab_contents, profile_, content_settings_type),
1379 profile_, tab_contents); 1380 profile_, tab_contents->tab_contents());
1380 return TRUE; 1381 return TRUE;
1381 } 1382 }
1382 1383
1383 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose( 1384 gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose(
1384 GtkWidget* sender, GdkEventExpose* event) { 1385 GtkWidget* sender, GdkEventExpose* event) {
1385 if (!(animation_.IsShowing() || animation_.IsClosing())) 1386 if (!(animation_.IsShowing() || animation_.IsClosing()))
1386 return FALSE; 1387 return FALSE;
1387 1388
1388 const int height = sender->allocation.height; 1389 const int height = sender->allocation.height;
1389 1390
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 1635
1635 std::string badge_text = page_action_->GetBadgeText(tab_id); 1636 std::string badge_text = page_action_->GetBadgeText(tab_id);
1636 if (badge_text.empty()) 1637 if (badge_text.empty())
1637 return FALSE; 1638 return FALSE;
1638 1639
1639 gfx::CanvasSkiaPaint canvas(event, false); 1640 gfx::CanvasSkiaPaint canvas(event, false);
1640 gfx::Rect bounding_rect(widget->allocation); 1641 gfx::Rect bounding_rect(widget->allocation);
1641 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); 1642 page_action_->PaintBadge(&canvas, bounding_rect, tab_id);
1642 return FALSE; 1643 return FALSE;
1643 } 1644 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698